| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1106384 | SalihSahin | Lun (COCI19_lun) | C++14 | 1 ms | 504 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 pb push_back
#define int long long
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e17;
const int N = 2e5+5;
int op(int num){
    int x = 0;
    while(num > 0){
        x += num % 10;
        num /= 10;
    }
    return x;
}
int32_t main(){
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans = -1;
    for(int ch = 0; ch <= 9; ch++){
        int val = 0;
        for(int i = s.size()-2; i >= 0; i -= 2){
            if(s[i] == 'x') val += op(ch * 2);
            else val += op((s[i] - '0') * 2);
        }
        for(int i = s.size()-3; i >= 0; i -= 2){
            if(s[i] == 'x') val += ch;
            else val += (s[i] - '0');
        }
        int check = 0;
        if(s[s.size()-1] == 'x') check = ch;
        else check = s[s.size()-1] - '0';
        if((val * 9)%10 == check){
            ans = ch;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
