QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#129188 | #6522. Digit Mode | thenegotiator1 | Compile Error | / | / | C++14 | 2.0kb | 2023-07-22 05:15:50 | 2023-07-22 05:15:52 |
Judging History
This is the latest submission verdict.
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-22 05:15:52]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-07-22 05:15:50]
- Submitted
answer
def Digit_Mode(n):
dp=[1,0,0,0,0,0,0,0,0,0]## first 10 for the digits and last mymax for the max occurance and the dp[11] id the number of 9's from the right
mymax=0
sol=0
lastdig=0
for i in range(1,n+1):
if lastdig==10:
lastdig=0
if lastdig!=9:
dp[lastdig]-=1
dp[lastdig+1]+=1
if lastdig == mymax:
if dp[lastdig+1]>dp[mymax]:
mymax= lastdig+1
else:
tempmax=0
for i in range(10):
if dp[i]>=tempmax:
tempmax=dp[i]
mymax=i
else:
if dp[lastdig+1]>dp[mymax]:
mymax= lastdig+1
elif dp[lastdig+1]==dp[mymax]:
if mymax<lastdig+1:
mymax=lastdig+1
else: # if last dig 9
x=i-1
count=0
lda9=None
while True:
temp=x%10
if temp==9:
count+=1
x//=10
else:
lda9=temp
break
if x!=0:
dp[9]-=count
dp[0]+=count
dp[lda9+1]+=1
dp[lda9]-=1
else:
dp[9]-=count
dp[0]+=count
dp[lda9+1]+=1
lda9+=1
tempmax=0
for i in range(10):
if dp[i]>=tempmax:
tempmax=dp[i]
mymax=i
sol+=mymax
lastdig+=1
return sol
t = int(input())
for i in range(t):
n = int(input())
print(Digit_Mode(n))
Details
answer.code:2:29: error: stray ‘##’ in program 2 | dp=[1,0,0,0,0,0,0,0,0,0]## first 10 for the digits and last mymax for the max occurance and the dp[11] id the number of 9's from the right | ^~ answer.code:2:125: error: digit separator outside digit sequence 2 | dp=[1,0,0,0,0,0,0,0,0,0]## first 10 for the digits and last mymax for the max occurance and the dp[11] id the number of 9's from the right | ^~~ answer.code:31:15: error: stray ‘#’ in program 31 | else: # if last dig 9 | ^ answer.code:1:1: error: ‘def’ does not name a type 1 | def Digit_Mode(n): | ^~~