Cod sursa(job #948297)
| Utilizator | Data | 9 mai 2013 21:31:20 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream is("cifra.in");
ofstream os("cifra.out");
int n;
int x;
double uc;
int main()
{
is >> n;
for( int i = 0; i < n; ++i )
{
uc = 0;
is >> x;
for( int j = 1; j <= x; ++j )
uc += pow( j, j );
if( x < 3 )
os << uc;
else
os << (uc/10 - floor(uc/10))*10;
os << '\n';
}
is.close();
os.close();
return 0;
}
