题目描述
牛牛最近学习了 C++ 入门课程,这门课程的总成绩计算方法是:
总成绩=作业成绩×20%+小测成绩×30%+期末考试成绩×50% \text{总成绩}=\text{作业成绩}\times 20\%+\text{小测成绩}×30\%+\text{期末考试成绩} \times 50\% 总成绩=作业成绩×20%+小测成绩×30%+期末考试成绩×50%
牛牛想知道,这门课程自己最终能得到多少分。
输入格式
三个非负整数 A,B,CA,B,CA,B,C,分别表示牛牛的作业成绩、小测成绩和期末考试成绩。相邻两个数之间用一个空格隔开,三项成绩满分都是 100100100 分。
输出格式
一个整数,即牛牛这门课程的总成绩,满分也是 100100100 分。
输入输出样例
输入
100 100 80
输出
90
说明/提示
数据说明
对于 30%30\%30% 的数据,A=B=0A=B=0A=B=0。
对于另外 30%30\%30% 的数据,A=B=100A=B=100A=B=100。
对于 100%100\%100% 的数据,0≤A,B,C≤1000≤A,B,C≤1000≤A,B,C≤100 且 A,B,CA,B,CA,B,C 都是 101010 的整数倍。
方式
代码
class Solution:
@staticmethod
def oi_input():
"""从标准输入读取数据"""
a, b, c = map(int, input().split())
return a, b, c
@staticmethod
def oi_test():
"""提供测试数据"""
return 100, 100, 80
@staticmethod
def solution(a, b, c):
'''这种方式可以避免小数,虽然题目的情况下不会有小数'''
print((a * 20 + b * 30 + c * 50) // 100)
oi_input = Solution.oi_input
oi_test = Solution.oi_test
solution = Solution.solution
if __name__ == '__main__':
a, b, c = oi_test()
# a, b, c = oi_input()
solution(a, b, c)
427

被折叠的 条评论
为什么被折叠?



