Cod sursa(job #340417)

Utilizator rathegodsotoc sergiu rathegod Data 14 august 2009 16:52:51
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include<fstream.h>
#include<math.h>
int program(int k)
{
	return (pow(k,k));
}
int main()
{
	ifstream f("cifra.in");
	ofstream g("cifra.out");
	int n,i,j,sem=1;
	f>>n;
	int total=0;
	while(!f.eof())
	{
		total=0;
		f>>i;
		if(sem)
		{
		for(j=1;j<=i;j++)
			total+=program(j%10)%10;
		g<<total%10<<'\n';
		}
		if(i==n) sem=0;
	}
	return 0;
}