QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#331183#1371. Missing Numberaggrovector#AC ✓0ms3740kbC++14500b2024-02-18 03:09:542024-02-18 03:09:54

Judging History

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

  • [2024-02-18 03:09:54]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3740kb
  • [2024-02-18 03:09:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
long long n,j,pos,i;
string s,t;

long long digit(long long x) {
    long long cnt=0;
    while(x>0) {
        cnt++;
        x/=10;
    }
    return cnt;
}

int main() {
    cin >> n;
    cin >> s;
    for (i=1;i<=n;i++) {
        t="";
        for (j=pos;j<pos+digit(i);j++) {
            t+=s[j];
        }
        if (t!=to_string(i)) {
            cout << i << endl;
            return 0;
        }
        pos=j;
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3720kb

input:

2
1

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

2
2

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

100
23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

100
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899

output:

100

result:

ok single line: '100'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

100
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818384858687888990919293949596979899100

output:

82

result:

ok single line: '82'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

100
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586888990919293949596979899100

output:

87

result:

ok single line: '87'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

100
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798100

output:

99

result:

ok single line: '99'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

100
1234567891011121314151617181920212223242526272829303132333435363738394041424344454748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

46

result:

ok single line: '46'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

100
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

52

result:

ok single line: '52'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

20
12345678910111213141516181920

output:

17

result:

ok single line: '17'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

46
123456789101112131415161718192021222324252627282931323334353637383940414243444546

output:

30

result:

ok single line: '30'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

98
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777980818283848586878889909192939495969798

output:

78

result:

ok single line: '78'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

11
12345678911

output:

10

result:

ok single line: '10'