Cod sursa(job #1316776)
Utilizator | Data | 14 ianuarie 2015 09:12:50 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int p,n=1,i,q=0,x ;
f >> p;
while (q!=p)
{
for (i=5;i<=n;i=i+5)
{
x = i ;
while (x%5==0) { q++; x= x / 5 ; }
}
if (q!=p) {n++;q=0;}
}
g << n;
return 0;
}