QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61553 | #1371. Missing Number | Silverhorse7# | WA | 4ms | 3328kb | C++20 | 798b | 2022-11-14 05:48:15 | 2022-11-14 05:48:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N =2e5;
signed main(){
int n;
cin>>n;
string s;
cin>>s;
int mex =1;
int curMove=1;
for(int i = 0 ; i <s.size();i++){
if(curMove==1){
if((s[i]-'0')!=mex){return cout<<mex , 0;}
}
else if (curMove==2){
string tmp;
tmp+=s[i];
if(i+1 >=s.size()){
return cout<<mex,0;
}
tmp+=s[i+1];
if(stoi(tmp) !=mex) return cout<<mex, 0;
i++;
}
else if (curMove==3){
string tmp;
tmp+=s[i];
if(i+1 >=s.size()){
return cout<<mex,0;
}
tmp+=s[i+1];
if(i+2 >=s.size())
return cout<<mex,0;
tmp+=s[i+2];
if(stoi(tmp) !=mex) return cout<<mex, 0;
i++;
i++;
}
mex++;
if(mex>=10)curMove++;
if(mex>=100)curMove++;
}
cout<<mex<<endl;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3308kb
input:
2 1
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 4ms
memory: 3236kb
input:
2 2
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3328kb
input:
100 23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 3ms
memory: 3320kb
input:
100 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
output:
11
result:
wrong answer 1st lines differ - expected: '100', found: '11'