Cod sursa(job #1325797)
Utilizator | Data | 24 ianuarie 2015 12:58:08 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
int exponent,p,n,x,y,s;
int main()
{
ifstream in("fact.in");
ofstream out("fact.out");
in>>p>>n;
if(!p)
out<<1;
else
{
s=0;
x=5;
while(s<p)
{
exponent=0;
y=x;
while(y%5==0)
{
exponent++;
y/=5;
}
s=s+exponent;
x=x+5;
}
out<<x-5;
}
in.close();
out.close();
return 0;
}