Pagini recente » Cod sursa (job #358073) | Cod sursa (job #3140086) | Cod sursa (job #2371080) | Cod sursa (job #560310) | Cod sursa (job #579273)
Cod sursa(job #579273)
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
int p , aux , n ;
int i = 0 ;
fstream f("fact.in",ios::in );
f>>p ;
aux = p * 5 ;
n = aux ;
f.close();
for( i = 0 ; i < n ; i+= 5 )
{
while( i != 0 & i%5 == 0)
{
i/=5;
if(i % 5 == 0)
aux-=5;
}
}
fstream g ("fact.out",ios::out );
if ( i == n && i!=0 )
g << -1;
else
if( i )
g << aux ;
if( p == 0)
g << 1 ;
g.close();
return 0 ;
}