Cod sursa(job #1263300)

Utilizator test72101S.A.C. test72101 Data 14 noiembrie 2014 14:36:13
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <iostream>
#include <fstream>
  
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
 
int n,k;
long long i,x;
int main()
{
    fin>>n;
    while (k<n)
    {
        i+=5;
        x=i;
        while (x%5==0)
        {
            if (x%5==0) k++;
            x=x/5;
        }
         
    }
    if (k==n) fout<<i;
        else fout<<"-1";
    fin.close();
    fout.close();
    return 0;
}