Cod sursa(job #2713351)
Utilizator | Data | 27 februarie 2021 19:37:06 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | vlad_oji | Marime | 0.51 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream cin("fact.in");
ofstream cout("fact.out");
int p,cnt=0,cf,cnt2=0,i=1;
long long f = 1;
cin >> p;
for(int i = 1; i <= 200000000; i++)
{
cnt = 0;
f = f * i;
cnt2++;
cf = f;
while(cf > 0)
{
if(cf % 10 == 0)
cnt++;
else
break;
cf /= 10;
}
if(cnt >= p)
break;
}
cout << cnt2;
return 0;
}