# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103576 | kishtarn555 | Lun (COCI19_lun) | C++14 | 2 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;
int N;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin >>N;
char c;
long long sum = 0;
long long pos;
long long last;
for (int i = 0; i < N; i++) {
cin >> c;
if (c=='x') {
pos = i;
continue;
}
if (i+1==N) {
last = c-'0';
continue;
}
if ( i%2!=N%2) {
sum+=c-'0';
} else {
// cout <<(int)((c-'0')*2)<<endl;
sum+= ((c-'0')*2)/10;
sum +=((c-'0')*2)%10;
}
}
// cout << sum<< endl;
if (pos +1==N) {
sum*=9;
cout<<sum%10;
return 0;
}
// c
// cout << last<<endl;
for (int i = 0; i < 10; i ++) {
long long ss = sum+i;
if (pos %2!=N%2) {
} else {
cout << "!";
ss=sum + (2*i)/10+(2*i)%10;
}
if ((ss*9)%10==last) {
cout << i;return 0;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |