Cod sursa(job #1312289)
Utilizator | Data | 9 ianuarie 2015 09:28:18 | |
---|---|---|---|
Problema | Cifra | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int t, v[101];
long long n;
int a[10][4]={
0,0,0,0,
1,1,1,1,
6,2,4,8,
1,3,9,7,
6,4,6,4,
5,5,5,5,
6,6,6,6,
1,7,9,3,
6,8,4,2,
1,9,1,9};
int main()
{
int s=0;
for(int i=0;i<=99;i++)
{s+=a[i%10][i%4];
v[i]=s%10;
}
f>>t;
while(t--)
{ f>>n;
g<<v[n%100]<<'\n';
}
return 0;
}