Cod sursa(job #1586947)

Utilizator georgemihocMihoc George georgemihoc Data 1 februarie 2016 19:06:50
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <fstream>
#include <math.h>

using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int t,n,i,j,s,k,l;
int main()
{
    f>>t;
    for(i=1;i<=t;i++){
        f>>n;
        s=0;
        for(j=1;j<=n;j++){
            l=1;
            for(k=1;k<=j;k++) l=l*j;
            s=s+l;
        }
        g<<(s%10)<<'\n';
    }
    return 0;
}