QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#668464 | #9255. Python Program | O_start | RE | 0ms | 0kb | Python3 | 1.3kb | 2024-10-23 14:31:31 | 2024-10-23 14:31:47 |
Judging History
answer
lines = []
ch_i = ' '
for i in range(5):
line = input()
lines.append(line)
def get_from_range(s: str):
temp = s.split('(')[1]
temp = temp.split(')')[0]
temp = temp.split(',')
if len(temp) < 3:
temp.append('1')
return temp
def fuck(ch: str, num_i: int):
if ch == ch_i:
return num_i
return int(ch)
def div1(a, b):
if a % b == 0:
return a // b - 1
else:
return a // b
def div2(a, b):
if a % b == 0:
return a // b + 1
else:
return a // b + 1
def get_sum(d, e, f):
if f > 0:
if d >= e:
return 0
st = d
max_k = div1(e - d, f)
ed = st + max_k * f
return int((st + ed) * (max_k + 1) // 2)
else:
if d <= e:
return 0
st = d
max_k = div1(e - d, f)
ed = st + max_k * f
return int((st + ed) * (max_k + 1) // 2)
line1_list = lines[1].split(' ')
line2_list = lines[2].split(' ')
ch_i = line1_list[1]
vals1 = get_from_range(line1_list[3])
vals2 = get_from_range(line2_list[3])
# print(vals1)
# print(vals2)
ans = 0
for i in range(int(vals1[0]), int(vals1[1]), int(vals1[2])):
ans += get_sum(fuck(vals2[0], i), fuck(vals2[1], i), fuck(vals2[2], i))
print(ans)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
ans=0 for a in range(1,3): for b in range(5,1,-2): ans+=b print(ans)