Cod sursa(job #1167987)
Utilizator | Data | 6 aprilie 2014 15:32:10 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
#include <cmath>
using namespace std;
int i;
ifstream in("cifra.in");
ofstream out("cifra.out");
void suma(int n)
{
int j,s=0;
for(j=1;j<=n;j++)
{
s+=pow(j,j);
}
out<<s%10<<"\n";
}
int main()
{
int t,n;
in>>t;
for(i=1;i<=t;i++)
{
in>>n;
suma(n);
}
in.close();
out.close();
return 0;
}