Cod sursa(job #892511)
| Utilizator | Data | 26 februarie 2013 10:15:03 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>]
#include <fstream>
using namespace std;
int main()
{
int t,n[100],i,j,nr=1,k,s;
std::ifstream in("cifra.in");
std::ofstream out("cifra.out");
in>>t;
for (i=1;i<=t;i++)
in>>n[i];
for (i=1;i<=t;i++)
{s=0;
for (j=1;j<=n[t];j++)
{k=j;
while (nr<=j)
{k=k*k;
nr++;}
s=s+k;}
out<<s%10<<endl;}
in.close();
out.close();
return 0;
}
