Cod sursa(job #36481)

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