题目描述
有一只小鱼,它平日每天游泳 250250250 公里,周末休息(实行双休日),假设从周 xxx 开始算起,过了 nnn 天以后,小鱼一共累计游泳了多少公里呢?
输入格式
输入两个正整数 x,nx,nx,n,表示从周 xxx 算起,经过 nnn 天。
输出格式
输出一个整数,表示小鱼累计游泳了多少公里。
输入输出样例
输入
3 10
输出
2000
说明/提示
数据保证,1≤x≤71\le x \le 71≤x≤7,1≤n≤1061 \le n\le 10^61≤n≤106。
方式
代码
class Solution:
@staticmethod
def oi_input():
"""从标准输入读取数据"""
x, n = map(int, input().split())
return x, n
@staticmethod
def oi_test():
"""提供测试数据"""
return 3, 10
@staticmethod
def solution(x, n):
now = x - 1
total = (n // 7) * 1250
for _ in range(n % 7):
if now <= 4: # 工作日(周一到周五)
total += 250
now = (now + 1) % 7 # 更新到下一天
print(total)
oi_input = Solution.oi_input
oi_test = Solution.oi_test
solution = Solution.solution
if __name__ == '__main__':
x, n = oi_test()
# x, n = oi_input()
solution(x, n)
812

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



