Cod sursa(job #1803640)
Utilizator | Data | 11 noiembrie 2016 17:26:23 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int n,p,x;
n = 1;
f>>p;
while(p > 0){
n+=5;
if(n == 6)
n--;
x = n;
while(x % 5 == 0){
p--;
x = x / 5;
}
}
if(p < 0)
g<<-1;
else
g<<n;
return 0;
}