Cod sursa(job #1328058)

Utilizator Bogdan15Bogdan Gherghina Bogdan15 Data 27 ianuarie 2015 23:09:34
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
#include<cmath>
#define InFile "cifra.in"
#define OutFile "cifra.out"
using namespace std;
ifstream f(InFile);
ofstream g(OutFile);
int T;
long long N;
int main(){
    f>>T;
    int i;
    long long j,s;
    for(i=1;i<=T;i++){
        f>>N;
        s=0;
        for(j=1;j<=N;j++)
            s+=pow(j,j);
        g<<s%10<<"\n";
    }
    f.close();
    g.close();
    return 0;
}