Submission #103574

#TimeUsernameProblemLanguageResultExecution timeMemory
103574kukoLun (COCI19_lun)C++11
25 / 50
3 ms384 KiB
#include <bits/stdc++.h> using namespace std; char account[128]; int main() { int n, d, sum = 0; cin >> n; cin >> account; int multiplier = 1; for( int i = n - 2; i >= 0; i -= 2 ) { if( account[i] == 'x' ) { multiplier = 2; continue; } d = account[i] - '0'; d *= 2; d = d%10 + d/10; account[i] = d + '0'; } for( int i = 0; i < n - 1; i++ ) if( account[i] != 'x' ) sum += account[i] - '0'; int newsum = 0, lastdigit = account[n - 1] - '0'; for( int k = 0; k < 10; k++ ) { newsum = sum + (k*multiplier)%10 + (k*multiplier)/10; if( (newsum * 9) % 10 == lastdigit ) { cout << k; return 0; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...