Cod sursa(job #675676)
Utilizator | Data | 7 februarie 2012 22:33:04 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream>
#include<math.h>
using namespace std;
int main(){
int t,n,s=0,i,j;
ifstream f("cifra.in");
ofstream g("cifra.out");
// Rezolvare
f>>t;
if(t>=1&&t<=30000)
for(i=1;i<=t;i++){
f>>n;
if(n>=1&&n<pow(10,100))
for(j=1;j<=n;j++){
s=s+pow(j,j);
}
g<<s%10<<endl;
s=0;
}
}