Submission #100302

#TimeUsernameProblemLanguageResultExecution timeMemory
100302tpoppoLun (COCI19_lun)C++14
50 / 50
4 ms384 KiB
#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 timeMemoryGrader output
Fetching results...