QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#428680 | #8769. Champernowne Substring | ucup-team135# | Compile Error | / | / | C++20 | 4.1kb | 2024-06-01 20:56:42 | 2024-06-01 20:56:43 |
Judging History
answer
import math
def main():
p=998244353
t=int(input())
for i in range(t):
ch2=10**40
res=10**40
s=str(input())
while(ord(s[len(s)-1])-ord('0')>9 or ord(s[len(s)-1])-ord('0')<0):
s=s[0:len(s)-1:1]
B=len(s)
def get(ch):
val=int(ch)
l=len(ch)
res1=(val-10**(l-1))*l
for i in range(l-1):
res1+=(9*(10**i))*(i+1)
return res1
def check(ch,pos,ch1):
if(ch[0]=='0'):
return 10**40
val=int(ch)
if(val>ch1):
return
s1=str()
while(len(s1)<pos+len(s)):
h=str(val)
for i in range(len(h)):
if(len(s1)+i>=pos and len(s1)+i<pos+len(s) and s1[i-pos]!='?' and h[i]!=s1[i-pos]):
return 10**40
s1+=h
val+=1
to=s1[pos:pos+len(s):1]
assert(len(s)==len(to))
for i in range(len(s)):
if(s[i]==to[i] or s[i]=='?'):
pass
else:
return 10**40
ch1=ch
return get(ch)+pos+1
for k in range(B+1):
for x in range(11):
for l in range(27//max(k,1)):
num=0
num=x*(10**k)-l
if(x==10 and k==0 and l==3):
pass
#print(num)
if(num>=1 and len(str(num))<=k+1):
if(x==1 and k==0 and l==3):
pass
#print(num)
for a in range(B+1):
if(a+k+1<=B+1):
ch=str()
if(a>=1):
ch+='1'
for i in range(a-1):
ch+='0'
le=k+1-len(str(num))
for i in range(le):
ch+='0'
ch+=str(num)
was=False
if(a==0 and x==10 and k==0 and l==3):
pass
#print(ch)
if(ch=="10003"):
was=False
ch1=ch
assert(len(ch)==a+k+1)
for pos in range(a+k+1):
ch=ch1
for i in range(len(s)):
if(was):
print(a)
j=(pos+i)%(a+k+1)
if(j<a):
if(s[i]!='?'):
if(was):
print(i)
if(s[i]>ch[j]):
if(was and pos==4):
print(i,s[i],j)
ch=ch[0:j:1]+s[i]+ch[j+1:len(ch):1]
if(was and pos==4):
print(ch)
answ=10**40
if(s[0]=='?' or ch[pos]==s[0]):
answ=check(ch,pos,ch2)
if(answ<res):
res=answ
ch1=ch
print(res%p)
main()
詳細信息
answer.code:49:34: error: invalid preprocessing directive #print 49 | #print(num) | ^~~~~ answer.code:53:34: error: invalid preprocessing directive #print 53 | #print(num) | ^~~~~ answer.code:68:42: error: invalid preprocessing directive #print 68 | #print(ch) | ^~~~~ 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’