Cod sursa(job #1436428)
Utilizator | Data | 15 mai 2015 21:32:37 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int n=0,p,k=0,cop,i;
f>>p;
if(p==0)
g<<-1;
else
{
for(i=5; k<p; i++)
{
cop=i;
while(cop%5==0)
{
cop=cop/5;
k++;
}
if(i%5==0)
n=n+5;
}
g<<n;
}
return 0;
}