Cod sursa(job #426262)

Utilizator NaSaCiocionica Ionut NaSa Data 26 martie 2010 17:48:43
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<iostream>
#include<fstream>
long long a,t,i,s,j,p;
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{i=1;
    f>>t;
    while(i!=t+1)
        {f>>a;
    p=1;
        for(j=1;j<=a;j++)
         p=p*a%10;
            s+=p%10;
            s=s%10;
        g<<s;
        g<<endl;
		i++;}
g.close();
f.close();
return 0;
}