Cod sursa(job #577772)

Utilizator SCBbestofSocaciu-Cumpanasu Bogdan SCBbestof Data 10 aprilie 2011 16:34:59
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<stdio.h>
#include<math.h>
unsigned long long int N,j,aux;
int i,T;
int main()
{
	FILE *f = fopen("cifra.in","r");
	FILE *g = fopen("cifra.out","w");
	fscanf(f,"%d",&T);
	for(i=1;i<=T;i++)
	{
		fscanf(f,"%llu",&N);
		
		if(N==0)
			N=1;
		else
		{
			aux=1;
			for(j=2;j<=N;j++)
			{
				
				aux=aux+pow(j,j);
				printf("%llu",j);
			}
		}
		N=aux%10;
		fprintf(g,"%llu\n",N);
	}
	fclose(f);
	fclose(g);
	return 0;
}