Cod sursa(job #1235052)
Utilizator | Data | 28 septembrie 2014 17:16:47 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <fstream>
using namespace std;
ifstream fi ("fact.in");
ofstream fo ("fact.out");
unsigned long long p,x,n,a,b;
int main()
{
fi>>p;
while (x==0)
{
n++;
x=n;
if (a<p)
while (x%2==0)
{
x=x/2;
a++;
if (a>=p) break;
}
if (b<p)
while (x%5==0)
{
x=x/5;
b++;
if (b>=p) break;
}
x=0;
if ((a>=p) and (b>=p)) break;
}
fo<<n;
return 0;
}