Cod sursa(job #2206678)

Utilizator cyg_ionutStan Ionut Gabriel cyg_ionut Data 23 mai 2018 13:29:42
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <fstream>
#include <algorithm>
using namespace std;

int main()
{
    ifstream fin("fact.in");
    ofstream fout("fact.out");
    int n,a=5,ca,p=0;
    fin >> n;
    ca=1;
    while(n>0)
    {
        ca=a;
        while(a%5==0)
        {
            p++;
            a=a/5;
        }
        n=n-p;
        ca++;
        a=ca;
        p=0;
    }
    if(ca>1)
        fout << ca-1;
    else
        fout << 1;
    return 0;
}