QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#647337 | #9255. Python Program | Mu_Silk# | Compile Error | / | / | C++20 | 878b | 2024-10-17 13:26:56 | 2024-10-17 13:26:56 |
Judging History
answer
import math
def solve():
s=input()
l1=input().split(' ')
l2=input()[4:].split(' ')
sym=l1[1]
rg1=list(map(int,l1[3][6:-2].split(',')))
if(len(rg1)<3):rg1.append(1)
rg2=l2[3][6:-2].split(',')
if(len(rg2)<3):rg2.append('1')
ans=0
for i in range(rg1[0],rg1[1],rg1[2]):
l,r,s=rg2
if(l==sym):l=i
else: l=int(l)
if(r==sym):r=i
else: r=int(r)
if(s==sym):s=i
else: s=int(s)
l1,r1,cnt=0,abs(r-l)+1,0
while(r1>=l1):
m=(l1+r1)>>1
if (s>0 and l+s*(m-1)<r) or (s<0 and l+s*(m-1)>r):
cnt=m
l1=m+1
else:
r1=m-1
# print(l,r,s,cnt)
ans+=(l+l+(cnt-1)*s)*cnt//2
print(ans)
_=1
# _=int(input())
while(_>0):
_-=1
solve()
详细
answer.code:35:11: error: invalid preprocessing directive #print 35 | # print(l,r,s,cnt) | ^~~~~ answer.code:41:3: error: invalid preprocessing directive #_ 41 | # _=int(input()) | ^ answer.code:1:1: error: ‘import’ does not name a type 1 | import math | ^~~~~~ answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’, which is not yet enabled with ‘-std=c++20’