Cod sursa(job #1049611)
Utilizator | Data | 7 decembrie 2013 16:20:51 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
void solve()
{
unsigned n,s,i,j;
unsigned long x;
ifstream f ("cifra.in");
f>>n;
ofstream g ("cifra.out");
while(f>>x)
{
s=0;
for(i=1;i<=x;i++)
{s=s+pow(i,i);
s=s%10;}
g<<s<<'\n';
}
f.close();
g.close();
}
int main()
{
solve();
return 0;
}