QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#674359 | #9255. Python Program | mzyx | AC ✓ | 832ms | 10652kb | Python3 | 1.4kb | 2024-10-25 15:24:49 | 2024-10-25 15:24:50 |
Judging History
answer
l1 = input()
l2 = input()
l3 = input()
l4 = input()
l5 = input()
l2 = l2.split(' ')
l3 = l3.split(' ')
while len(l2) > 0 and l2[0] == '':
del l2[0]
while len(l3) > 0 and l3[0] == '':
del l3[0]
i = l2[1]
j = l3[1]
s = len(l2[3])
ss = ''
ml1 = []
for x in range(6, s):
if l2[3][x] != ',' and l2[3][x] != ')':
ss += l2[3][x]
else:
ml1.append(ss)
ss = ''
ss = ''
ml2 = []
s = len(l3[3])
for x in range(6, s):
if l3[3][x] != ',' and l3[3][x] != ')':
ss += l3[3][x]
else:
ml2.append(ss)
ss = ''
if len(ml1) == 2:
ml1.append('1')
a, b, c = int(ml1[0]), int(ml1[1]), int(ml1[2])
d, e, f = 0, 0, 0
if len(ml2) == 2:
ml2.append('1')
t = str(int(ml2[0] == i)) + str(int(ml2[1] == i)) + str(int(ml2[2] == i))
ans = 0
for x in range(a, b, c):
if t == '000':
d, e, f = int(ml2[0]), int(ml2[1]), int(ml2[2])
if t == '001':
d, e, f = int(ml2[0]), int(ml2[1]), x
if t == '010':
d, e, f = int(ml2[0]), x, int(ml2[2])
if t == '100':
d, e, f = x, int(ml2[1]), int(ml2[2])
if t == '110':
d, e, f = x, x, int(ml2[2])
if t == '101':
d, e, f = x, int(ml2[1]), x
if t == '011':
d, e, f = int(ml2[0]), x, x
if t == '111':
d, e, f = x, x, x
if e >= d and f <= 0:
continue
if e <= d and f >= 0:
continue
cnt = e - d
if f < 0:
cnt = -cnt
cnt = (cnt + abs(f) - 1) // abs(f)
ans += ((2 * d + (cnt - 1) * f) * cnt // 2)
print(ans)
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 10588kb
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: 7ms
memory: 10532kb
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: 814ms
memory: 10592kb
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: 162ms
memory: 10652kb
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: 832ms
memory: 10532kb
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