Cod sursa(job #1157340)
Utilizator | Pogonariu Radu raddudj | Data | 28 martie 2014 13:52:39 |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <cstdio>
#include <cstring>
using namespace std;
int v[120];
char s[300];
int main()
{
freopen("cifra.in","r",stdin);
freopen("cifra.out","w",stdout);
int i,put,curent;
for(i=1; i<=100; i++)
{
put=i%4;
if(!put)
put=4;
curent=1;
for(int j=1; j<=put; j++)
curent=(curent*i)%10;
v[i]=(v[i-1]+curent)%10;
}
int t,n,temp;
scanf("%d\n",&t);
for(i=1; i<=t; i++)
{
gets(s+1);
scanf("\n");
n=strlen(s+1);
temp=(s[n]-'0'+s[n-1]-'0')%100;
printf("%d\n",v[temp]);
}
return 0;
}