QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#395529#1371. Missing NumberzedanovWA 0ms3844kbC++201.0kb2024-04-21 15:59:312024-04-21 15:59:31

Judging History

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

  • [2024-04-21 15:59:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-04-21 15:59:31]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define zedanov                   \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define el "\n"

void doWork()
{
    int n;
    string a;
    cin >> n;
    cin >> a;
    int cur = 1;
    for (int i = 0; i < a.size(); i++, cur++)
    {
        if (cur < 10)
        {
            if (cur != (a[i] - '0'))
            {
                cout << cur;
                return;
            }
        }
        else if (cur < 100)
        {
            if (i + 1 >= a.size() || cur != stoi(a.substr(i, 2)))
            {
                cout << cur;
                return;
            }
        }
        else
        {
            if (i + 2 >= a.size() || cur != stoi(a.substr(i, 3)))
            {
                cout << cur;
                return;
            }
        }
    }
    cout << cur;
}

signed main()
{
    zedanov int t = 1;
    // cin >> t;
    while (t--)
        doWork();

    return 0;
}

詳細信息

Test #1:

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

input:

2
1

output:

2

result:

ok single line: '2'

Test #2:

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

input:

2
2

output:

1

result:

ok single line: '1'

Test #3:

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

input:

100
23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

1

result:

ok single line: '1'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

100
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899

output:

11

result:

wrong answer 1st lines differ - expected: '100', found: '11'