Pagini recente » Cod sursa (job #3145756) | Cod sursa (job #2931303) | Cod sursa (job #1232008) | Cod sursa (job #1203167) | Cod sursa (job #948297)
Cod sursa(job #948297)
#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;
}