Cod sursa(job #30641)

Utilizator gabor_oliviu1991gaboru corupt gabor_oliviu1991 Data 14 martie 2007 19:45:02
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include<fstream.h>
#include<math.h>
int main() {
ifstream f("cifra.in");
ofstream g("cifra.out");
int t,i,x,s[100],S,k=0,j;
double n;
f>>t>>n;
for(i=1;i<=t;i++)
	{f>>n;S=0;
	 for(j=1;j<n;j++)
		{x=pow(j,j);
		 S+=(x%10)%10;}
	 s[k++]=S%10;
	 }
for(k=0;k<t;k++)
	g<<s[k]%10<<endl;
f.close();
g.close();
return 0;
}