Cod sursa(job #2531970)
Utilizator | Data | 26 ianuarie 2020 22:28:02 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("cifra.in");
ofstream g("cifra.out");
int v[]={0,1,4,7,6,5,6,3,6,9};
int t,i,j,s;
f>>t; char x;
for(i=0;i<t;i++){
f>>x;
s=0;
if(x-'0'<10)
for (j=1;j<=x-'0';j++){
s+=v[j];
s%=10;
}
g<<s%10<<"\n";
}
return 0;
}