Cod sursa(job #1490143)
Utilizator | Data | 22 septembrie 2015 19:44:34 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int p,n=1,c5=0;
f>>p;
if (p<0) g<<-1;
else {
while (c5<p) {
int n1=n;
while (n1%5==0) {
c5++;
n1/=5;
}
n++;
}
g<<n-1;
}
}