QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619185 | #9255. Python Program | ucup-team5071# | AC ✓ | 647ms | 10700kb | Python3 | 1.2kb | 2024-10-07 13:27:08 | 2024-10-07 13:27:08 |
Judging History
answer
input()
s1 = input()
s2 = input()
input()
input()
alpha = "abcdefghijklmnopqrstuvwxyz"
# s1 = "for a in range(1,3):"
# s2 = " for b in range(5,1,-2):"
# # s1 = "for q in range(100,50,-1):"
# # s2 = "for i in range(q,77,20):"
y1 = s1[s1.find("(")+1:s1.find(")")].split(",")
y2 = s2[s2.find("(")+1:s2.find(")")].split(",")
# print(y1)
# print(y2)
a = int(y1[0])
b = int(y1[1])
if (len(y1) == 2):
c = 1
else:
c = int(y1[2])
# print(a,b,c)
ans = 0
for i in range(a,b,c):
if y2[0] in alpha:
d = i
else:
d = int(y2[0])
if y2[1] in alpha:
e = i
else:
e = int(y2[1])
if len(y2) == 2:
f = 1
else:
if y2[2] in alpha:
f = i
else:
f = int(y2[2])
# print(d,e,f)
# for j in range(d,e,f):
# print(j)
# ans += j
if f > 0:
if d >= e:
continue
k = (e-d-1)//f
ans += (d+d+k*f)*(k+1)//2
else:
if d <= e:
continue
k = (e-d+1)//f
# print((d+d+k*f)*(k+1)//2)
# print(d,k)
ans += (d+d+k*f)*(k+1)//2
print(ans)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 15ms
memory: 10580kb
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: 9ms
memory: 10580kb
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: 647ms
memory: 10584kb
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: 114ms
memory: 10700kb
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: 647ms
memory: 10640kb
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