Cod sursa(job #1455210)
Utilizator | Data | 27 iunie 2015 14:15:05 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
long long int s=1,x;
int main()
{
int n,p,ct=0,i=1;;
fin>>p;
while(s>=1)
{
s=s*i;
x=s;
ct=0;
while(x%10==0)
{
ct++;
x=x/10;
}
if(ct==p)
{
break;
}
i++;
}
fout<<" "<<i;
return 0;
}