Cod sursa(job #734164)
Utilizator | Data | 13 aprilie 2012 18:45:11 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.71 kb |
# include <fstream>
using namespace std ;
int main ( )
{
ifstream fin("fact.in") ;
ofstream fout("fact.out") ;
long long P , c = 0 , N = 0, a = 0 , b ;
fin >> P ;
if(P == 0) N = 1 ;
else while(c < P) {
a = 0 ;
N = N + 5 ;
b = N ;
while((b % 5 == 0) && (b > 0)) {
a++ ;
b = b / 5 ;
}
c = c + a ;
}
fout << N ;
return 0 ;
}