Cod sursa(job #36164)

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