Cod sursa(job #1110324)
Utilizator | Data | 17 februarie 2014 23:05:26 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int n=1,p,k=1,x=1;
long long y;
f>>p;
while(x<=p)
{
n++;
k=k*n;
y=pow(10,x);
if(k%y==0)
{x++;
}
}
g<<n;
return 0;
}