QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394646 | #1371. Missing Number | Omar_Alaa03# | WA | 1ms | 3816kb | C++20 | 882b | 2024-04-20 17:11:28 | 2024-04-20 17:11:29 |
Judging History
answer
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define ld long double
#define no "NO"
#define yes "YES"
#define forr(n) for(int i = 0;i < n; i++)
#define d(n) cout<<"value of "<<#n<<" is "<<n<<endl
#define endl '\n'
using namespace std;
const int N = 1e6 + 5, mode = 1e9 + 7;
void Code() {
int n;
string s;
cin >> n >> s;
string tmp = "";
for (int i = 1; i <= n; i++) {
tmp += to_string(i);
}
for (int i = 0; i < s.size(); i++) {
if (s[i] != tmp[i]) {
if (i > 8)
cout << tmp[i - 1];
cout << tmp[i];
return;
}
}
cout << n;
}
int main() {
fast
int tc = 1;
// cin >> tc;
while (tc--)
Code();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3504kb
input:
2 1
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
2 2
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
100 23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
100 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
output:
100
result:
ok single line: '100'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
100 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818384858687888990919293949596979899100
output:
82
result:
ok single line: '82'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
100 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586888990919293949596979899100
output:
87
result:
ok single line: '87'
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3808kb
input:
100 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798100
output:
89
result:
wrong answer 1st lines differ - expected: '99', found: '89'