Cod sursa(job #2250822)
Utilizator | Data | 30 septembrie 2018 18:39:42 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{int P,d=0,c=0,t;
long long i;
cin>>P;
for(i=2;i<=2100000000;i++)
if (d<P || c<P)
{t=i;
while(t%2==0)
{d++;
t=(t>>1);}
while(t%5==0)
{t=t*0.2;
c++;}}
else
break;
cout<<i-1;
return 0;
}