Cod sursa(job #1089382)
Utilizator | Data | 21 ianuarie 2014 17:47:22 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int fact,k,x,p;
f>>p;
fact=1;
k=0;
for(x=2;x<=p*5&&k<p;x++)
{
fact=fact*x;
while(fact%10==0)
{
k++;
fact=fact/10;
}
if(fact>1000) fact=256;
}
g<<x-1;
f.close();
g.close();
return 0;
}