QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#765826#9255. Python ProgramssmallC233#AC ✓540ms10724kbPython3942b2024-11-20 15:22:182024-11-20 15:22:24

Judging History

你现在查看的是最新测评结果

  • [2024-11-20 15:22:24]
  • 评测
  • 测评结果:AC
  • 用时:540ms
  • 内存:10724kb
  • [2024-11-20 15:22:18]
  • 提交

answer

code = ""

for i in range(2):
    code += input() + "\n"

s = input()
s = s.split(' ')
s = s[-1].split(',')
s[0] = s[0][6:]
s[-1] = s[-1][:-2]

if len(s) == 2:
    s.append('1')
# print(s)

if int(s[-1])<0:
    code+=f'\tif ({s[1]})>=({s[0]}):continue\n'
    code +=f'\tnum = max(0,({s[0]} - ({s[1]}) - ({s[2]})-1)//(-({s[2]})))\n'
    code +=f'\ta = {s[0]}\n'
    code +=f'\tb = {s[0]} + ({s[2]})*max(0,num-1)\n'
else:
    code+=f'\tif ({s[1]})<=({s[0]}):continue\n'
    code +=f'\tnum = max(0,(({s[1]}) - ({s[0]})+({s[2]})-1)//({s[2]}))\n'
    code +=f'\ta = {s[0]}\n'
    code +=f'\tb = {s[0]} + ({s[2]})*max(0,num-1)\n'

code += '\tans += (a+b)*num//2\n'
input()
code += input()
# print(code)
# print((19)//(-20))
exec(code)


# ans=0
# for a in range(1,3):
# for b in range(5,1,-2):
# ans+=b
# print(ans)


# ans=0
# for q in range(100,50,-1):
# for i in range(q,77,20):
# ans+=i
# print(ans)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 10656kb

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: 8ms
memory: 10632kb

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: 540ms
memory: 10724kb

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: 85ms
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: 486ms
memory: 10724kb

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