Cod sursa(job #473793)
Utilizator | Data | 31 iulie 2010 22:24:19 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
unsigned long y,p,t = 0;
f >> p;
for ( int x=5 ; ; x +=5 )
{
y=x;
while (y % 5 == 0) {
t++;
y = y / 5;
}
if ( y == p ) {
g << x;
break;
}
else if ( y > p )
{
g << -1;
break;
}
}
return 0;
}