QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#551044 | #9255. Python Program | ucup-team055# | AC ✓ | 353ms | 10604kb | Python3 | 763b | 2024-09-07 15:11:23 | 2024-09-07 15:11:24 |
Judging History
answer
S = [input() for i in range(5)]
'''
ans = 0
def g(a, b, c):
if ((b - a <= 0) and (c > 0)):return
if ((a - b <= 0) and (c < 0)):return
len = (abs(b - a) - 1 + abs(c)) // abs(c)
b = (len - 1) * c + a
ans += (a + b) * len // 2
'''
if S[2].count(',') == 1:
S[2] = S[2][:-2]
S[2] += ",1):"
l = 0
r = 0
for i in range(len(S[2])):
if (S[2][i] == '('): l = i
if (S[2][i] == ')'): r = i
f = "ans = 0"
f += "\n"
f += '''
def g(a, b, c):
if ((b - a <= 0) and (c > 0)):return 0
if ((a - b <= 0) and (c < 0)):return 0
len = (abs(b - a) - 1 + abs(c)) // abs(c)
b = (len - 1) * c + a
return (a + b) * len // 2
'''
f += S[1] + " ans += g" + S[2][l:r + 1]
f += "\n"
f += "print(ans)"
exec(f)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 12ms
memory: 10496kb
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: 12ms
memory: 10488kb
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: 0
Accepted
time: 353ms
memory: 10440kb
input:
ans=0 for i in range(1,1000000): for j in range(i,1,-1): ans+=j print(ans)
output:
166666666665500001
result:
ok single line: '166666666665500001'
Test #4:
score: 0
Accepted
time: 66ms
memory: 10604kb
input:
ans=0 for i in range(31,321983,2): for j in range(313,382193): ans+=j print(ans)
output:
11756963404587200
result:
ok single line: '11756963404587200'
Test #5:
score: 0
Accepted
time: 335ms
memory: 10480kb
input:
ans=0 for i in range(1,1000000): for j in range(i,114514,-1): ans+=j print(ans)
output:
160610445975856765
result:
ok single line: '160610445975856765'
Extra Test:
score: 0
Extra Test Passed