Cod sursa(job #1793531)

Utilizator robertro1Benedek Robert George robertro1 Data 31 octombrie 2016 09:45:22
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <bits/stdc++.h>

using namespace std;
int fct(int n){
    int rez = 0;
    while(n){
        rez += n / 5;
        n /= 5; }
    return rez; };

int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    long long n,p,st,dr;
    st=1;
    dr=2000000000;
    f>>p;
    for(int i=st;i<=dr;i++)
    {
        if(fct(i)==p)
        {
            g<<i;
            return 0;
        }

    }


    return 0;
}