Cod sursa(job #2599847)
Utilizator | Camburu Luca AswVwsA | Data | 11 aprilie 2020 19:37:22 |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;
ifstream in("cifra.in");
ofstream out("cifra.out");
int v[]={7,1,5,2,8,3,9,2,8,7};
char s[103];
int main(){
int t;
in>>t;in.get();
for (int i=1;i<=t;++i){
in.getline(s,104);
int d=strlen(s);
if (d>1)
out<<(7*(s[d-2]-'0')+ v[s[d-1]-'0'])%10;
else
out<<v[s[d-1]-'0'];
out<<'\n';
}
}