Cod sursa(job #1720836)
Utilizator | Data | 23 iunie 2016 17:36:14 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{ int p,i,j,k,j1;
in>>p;
if(p==0)
out<<1;
else
{i=0;k=0;
for(j=5;j<=999999999
;j=j+5)
{j1=j;
while(j1%5==0)
{k++;
j1=j1/5;
}
if(k==p)
break;
}
out<<j;
}
return 0;
}