Cod sursa(job #2080187)
Utilizator | Data | 2 decembrie 2017 15:53:24 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("factorial.in");
ofstream g("factorial.out");
int P;
int zerouri(int x)
{
int ans = 1;
x/=5;
while(!(x%5))
{
x/=5;
ans++;
}
return ans;
}
int main()
{
f >> P;
int n = 5;
if(P==0) g << 1 << endl;
else{
while(P)
{
P = P - zerouri(n);
n+=5;
}
g << n-5 << endl;
}
}