| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 224942 | VEGAnn | Lun (COCI19_lun) | C++14 | 6 ms | 512 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>
#define all(x) x.begin(),x.end()
using namespace std;
int n, vl[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}, loc;
string s;
bool ok(){
    int sm = 0;
    for (int i = 1; i < n; i++)
        if (i & 1){
            sm += vl[s[i] - '0'];
        } else {
            sm += s[i] - '0';
        }
    return ((sm * 9) % 10) == (s[0] - '0');
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> s;
    reverse(all(s));
    loc = s.find('x');
    for (int dg = 0; dg < 10; dg++) {
        s[loc] = char(dg + '0');
        if (ok()){
            cout << dg;
            return 0;
        }
    }
    return -1;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
