我正在尝试在 Hackerrank 上解决这个问题:https ://www.hackerrank.com/challenges/save-the-prisoner/problem
我的问题是我的代码在每个测试用例中都给了我超时错误,除了样本和测试用例#4。这是我的代码:
t = int(input())
store = []
for t_itr in range(t):
nms = input().split()
n = int(nms[0])
m = int(nms[1])
s = int(nms[2])
for i in range (0,m):
store.append(i % n + s)
print(store[-1])
我怎样才能让我的代码更快地运行而不会在测试用例中超时?