
思路:
1.由于不能回调,问题变得非常简单,先用外层循环遍历每一种指定要调时间点的情况。
2.内层循环用来判断走到该点最少要用多少步。
3.用K步调的时候绝对不允许超过index的值,少的部分用(index - start )的值去弥补。
n = int(input())
k = int(input())
step_sum_max = 0
for index in range(n):
calculate = 0
start = 0
while start + k <= index:
start += k
calculate += 1
calculate += (index - start)
if calculate >= step_sum_max:
step_sum_max = calculate
print(step_sum_max)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)