Cod sursa(job #1857611)
| Utilizator | Data | 26 ianuarie 2017 14:29:13 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
long s,nc,T,n,e,S;
ifstream citeste("cifra.in");
ofstream scrie("cifra.out");
citeste >> T;
nc=1;
s=0;
S=1;
e=1;
while (0<T)
{
citeste >> n;
while (nc<=n)
{
while (e<=nc)
{
S=S*nc;
e=e+1;
}
nc=nc+1;
s=s+S;
e=1;
S=1;
}
scrie << s%10 << endl;
s=0;
nc=1;
T=T-1;
}
citeste.close();
scrie.close();
return 0;
}
