Cod sursa(job #2189203)
Utilizator | Data | 27 martie 2018 20:13:22 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.66 kb |
#include <iostream>
#include <fstream>
#include <limits>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int p,fact=1,gasit=0;
f>>p;
int i=1;
while(gasit==0 && fact<2147483647)
{
int z=0;
int copie=fact;
while(copie%10==0)
{
copie=copie/10;
z++;
}
if(z==p)
{
g<<i;
gasit=1;
}
else
{
i++;
fact=i*fact;
}
}
return 0;
}