Cod sursa(job #200927)
Utilizator | Data | 27 iulie 2008 15:54:29 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream f ("cifra.in");
ofstream g ("cifra.out");
int t, u;
double n;
int main()
{ f >> t;
for (int i=1; i<=t; i++)
{ u=0;
f >> n;
for (double j=1; j<=n; j++)
u=(u+static_cast<int>(pow(j, j)))%10;
g << u << endl;
}
f.close();
g.close();
return 0;
}