Cod sursa(job #1983418)
Utilizator | Data | 21 mai 2017 22:19:47 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
long long t,n,s;
int main(){
fin>>t;
for(int i=1; i<=t;i++){
fin>>n; s=0;
for(int j=1; j<=n;j++){
int e=1;
for(int h=1; h<=j;h++)
e*=j;
s+=e;
}
fout<<s%10<<"\n";
}
}