Cod sursa(job #1905106)
Utilizator | Data | 5 martie 2017 21:55:02 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p, n, x;
int main()
{
f>>p;
if(p==0)
g<<1;
else {
n=5;
while(p>0) {
x=n;
while(x%5==0) {
p--;
x/=5;
}
n+=5;
}
g<<n-5;
}
g<<'\n';
f.close();
g.close();
return 0;
}