QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#606953 | #9255. Python Program | propane# | TL | 17ms | 10572kb | Python3 | 856b | 2024-10-03 13:12:55 | 2024-10-03 13:12:55 |
Judging History
answer
s = input()
s = input()
a, b, c = 0, 0, 1
s = s[s.find('(') + 1: s.find(')')]
lst = tuple(map(int, s.split(',')))
if len(lst) == 2:
a, b = lst
else:
a, b, c = lst
s = input()
lst = (s[s.find('(') + 1: s.find(')')]).split(',')
ans = 0
for i in range(a, b, c):
v = [0, 0, 1]
for j in range(len(lst)):
if (lst[j][0].isalpha()):
v[j] = i
else:
v[j] = int(lst[j])
if v[2] > 0:
v[1] -= 1
if v[1] >= v[0]:
v[1] = (v[1] - v[0]) // v[2] * v[2] + v[0]
ans += (v[0] + v[1]) * ((v[1] - v[0]) // v[2] + 1) // 2
else:
v[1] += 1
if v[1] <= v[0]:
v[1] = v[0] - (v[0] - v[1]) // abs(v[2]) * abs(v[2])
ans += (v[0] + v[1]) * ((v[0] - v[1]) // abs(v[2]) + 1) // 2
print(ans)
詳細信息
Test #1:
score: 100
Accepted
time: 17ms
memory: 10572kb
input:
ans=0 for a in range(1,3): for b in range(5,1,-2): ans+=b print(ans)
output:
16
result:
ok single line: '16'
Test #2:
score: 0
Accepted
time: 10ms
memory: 10572kb
input:
ans=0 for q in range(100,50,-1): for i in range(q,77,20): ans+=i print(ans)
output:
2092
result:
ok single line: '2092'
Test #3:
score: -100
Time Limit Exceeded
input:
ans=0 for i in range(1,1000000): for j in range(i,1,-1): ans+=j print(ans)