Cod sursa(job #1682957)
Utilizator | Data | 10 aprilie 2016 13:30:58 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
ifstream f("cifra.in");
ofstream g("cifra.out");
int t;
f >> t;
int *pv;
pv=new int [t];
for(int i=0; i<t; i++)
{
f >> *(pv+i);
int s=0;
for(int j=1; j<=*(pv+i); j++)
{
s=(s+int(pow(j, j))%10)%10;
}
g << s << endl;
}
}