Cod sursa(job #1277559)
Utilizator | Data | 27 noiembrie 2014 20:35:32 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
#include <cmath>>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int t,v[10],p[10];
int main()
{
int n,k=0,i,s=0,l=0,h;
f>>t;
for(n=1;n<=t;n++) {f>>v[n]; k++;}
while(k)
{
for(i=1;i<=v[k];i++)
s=s+pow(i,i); l++;
p[l]=s; k--; s=0;
}
for(h=t;h>=1;h--) g<<p[h]%10<<'\n';
f.close();
g.close();
return 0;
}