1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <bits/stdc++.h> #define IOS {ios::sync_with_stdio(false);cin.tie(0);} #define ll long long #define INF 0x3f3f3f3f
using namespace std; int n; string s; bool flag; int a[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; int ans[11] = {1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2}; bool solve() { int sum = 0; for(int i = 0; i < 17; i++) { if(s[i] <'0' || s[i] > '9') { return false; } sum += (s[i] - '0') * a[i]; } int temp = (s[17] == 'X') ? 10 : (s[17] - '0'); return temp == ans[sum % 11]; } int main() { IOS cin >> n; flag = false; while(n--) { cin >> s; if(!solve()) { cout << s << endl; flag = true; } } if(!flag) { cout << "All passed" << endl; } return 0; }
|