Cod sursa(job #36462)

Utilizator razyelxrazyelx razyelx Data 23 martie 2007 16:28:14
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.24 kb
#include <fstream.h>
#include <math.h>
int main(){
	long long a,k,s,i;
	ifstream f("cifra.in");
	ofstream g("cifra.out");
	f>>k;
	while(k){
		f>>a;s=0;
		for(i=1;i<=a;i++)
			s+=pow(i%10,i);
		g<<s%10<<"\n";
		k--;
	}
	return 0;
}