Cod sursa(job #2371490)

Utilizator Dragos4161Dima Dragos Ionut Dragos4161 Data 6 martie 2019 17:53:26
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;

int main()
{
    int T,N,i,j,s;
    ifstream f("cifra.in");
    ofstream g("cifra.out");
    f>>T;
    for(i=1;i<=T;i++){
        f>>N;
        s=0;
        for(j=1;j<=N;j++)
            s+=pow(j,j);
        g<<s%10<<endl;
    }
    return 0;
}