Cod sursa(job #1034034)
Utilizator | Data | 17 noiembrie 2013 17:01:02 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<time.h>
#include<cstring>
int t[101];
int main()
{
int n=100;
int b,o=0;
char s[120]="";
int l;
for(int i=1;i<=n;i++)
{
b=1;
for(int j=1;j<=i;++j) b = (i*b)%10;
o+=b;
t[i]=o%10;
}
freopen("cifra.in","r",stdin);
freopen("cifra.out","w",stdout);
scanf("%i",&n);
gets(s);
for(int i=0;i<n;i++)
{
gets(s);
l=s[strlen(s)-1]-'0';
if(strlen(s)>1)l+=10*(s[strlen(s)-2]-'0');
printf("%i\n",t[l]);
}
return 0;
}