Cod sursa(job #1704329)
Utilizator | Data | 18 mai 2016 16:52:40 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <math.h>
#include <fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
long long p=1,x;
x=pow(10,8);
double n,x1;
int ok=0,i=1;
f>>n;
if(n<=x)
{
x1=pow(10,n);
x=x1;
while(ok==0)
{
if(p>x)
p=p%x;
if(p%x==0)
ok++;
else
{
i++;
p=p*i;
}
}
g<<i;
}
return 0;
}