Cod sursa(job #815251)
Utilizator | Data | 16 noiembrie 2012 19:05:28 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{
unsigned int T,i;
long long S=0,N=0,p;
f>>T;
while (N!=T)
{
N++;
p=1;
for(i=1;i<=N;i++)
p=(p*N)%10;
S=(S+p)%10;
g<<S<<'\n';}
f.close();
g.close();
return 0;
}