# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100302 | tpoppo | Lun (COCI19_lun) | C++14 | 4 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 <bits/stdc++.h>
using namespace std;
int n;
string s;
bool check(){
int sm = 0;
for(int i=0;i<n-1;i++){
if(i%2 == n%2) sm += (2 * (s[i] - '0'))%10 + (2 * (s[i] - '0'))/10;
else sm += s[i] - '0';
}
return s[n-1] - '0' == (9*sm)%10;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n >> s;
int px = s.find('x');
for(char c='0';c<='9';c++){
s[px] = c;
if(check()){
cout<<c<<'\n';
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |