QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#726912#5634. RATSsefnuray#0 9ms10644kbPython3779b2024-11-09 10:17:322024-11-09 10:17:33

Judging History

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

  • [2024-11-09 10:17:33]
  • 评测
  • 测评结果:0
  • 用时:9ms
  • 内存:10644kb
  • [2024-11-09 10:17:32]
  • 提交

answer

def getnext(n):

    sm = int(n[::-1])+int(n)
    strsm= list(str(sm))
    strsm.sort()

    while '0' in strsm:
        strsm.remove('0')
    return ''.join(strsm)

def solve():
    # read 
    i, M, k = [int(i) for i in (input().split())]

    k=str(k)
    d={}
    d[k]=1

    m=1
    while(m<M):
        m+=1
        nxt= getnext(k)
        # check creeper
        if(nxt[:4]=='1233' and nxt[-3:]=='444'):
            print(i, 'C', m)
            return 
        if(nxt[:4]=='5566' and nxt[-4:]=='7777'):
            print(i, 'C', m)
            return
        if(nxt in d):
            print(i, 'R', m)
            return
        d[nxt]=1
        k=nxt

    print(i, k)
    return




t= int(input())
for i in range(t):
    solve()

详细


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 10644kb

input:

60
1 30 123
2 30 1
3 30 11233455677899
4 50 7
5 30 29
6 30 1233334444
7 30 237
8 30 11111111111111111111
9 30 88888888888888888888888888
10 30 88888888888888999999
11 36 11122234445556677778
12 47 111112233333444455556666677777889
13 53 1111222333344446666777788
14 43 111333334444577778999
15 50 133...

output:

1 R 10
2 C 20
3 666677888
4 C 20
5 R 28
6 C 2
7 R 15
8 C 14
9 R 19
10 R 28
11 R 28
12 R 44
13 C 28
14 15666777777
15 15555566677777777777
16 15666777777
17 1122277
18 R 21
19 4444555555
20 R 20
21 1111177777778
22 R 53
23 238889
24 88889999
25 145557777
26 11144445
27 1177
28 C 21
29 C 21
30 C 12
31...

result:

wrong answer 6th lines differ - expected: '6 C 1', found: '6 C 2'