Mai intai trebuie sa te autentifici.

Cod sursa(job #1858225)

Utilizator Ghiurutan2001Ghiurutan Dragos Ghiurutan2001 Data 27 ianuarie 2017 10:37:45
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int s,nc,T,e,S;
    long long n;
    ifstream citeste("cifra.in");
    ofstream scrie("cifra.out");
    if (!citeste.is_open())
    {
        cout << "Error" << endl;
        return -1;
    }
    citeste >> T;
    nc=1;
    s=0;
    S=1;
    e=1;
    while (T>0)
    {
        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;
}