Cod sursa(job #983715)
| Utilizator | Data | 12 august 2013 16:29:22 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
#include <cmath>
using namespace std;
int cifra(long long int n)
{
long long int suma=0,j;
for(j=1;j<=n;j++)
suma=suma+pow(j,j);
return suma%10;
}
int main()
{
ifstream f("cifra.in");
ofstream g("cifra.out");
long long int t,n,i;
f>>t;
i=1;
while(i<=t)
{
f>>n;
g<<cifra(n)<<endl;
i++;
}
f.close();
g.close();
return 0;
}
