Pagini recente » Cod sursa (job #2783242) | Cod sursa (job #164591) | Cod sursa (job #2919056) | Cod sursa (job #1946945) | Cod sursa (job #1329940)
# include <iostream>
# include <fstream>
int main () {
std :: ifstream f ("fact.in");
std :: ofstream g ("fact.out");
int P;
int nr = 0;
int i;
int a;
f >> P;
/*
if ( P == 0 ) {
g << 1;
} else {
a = P;
while ( a % 5 != 0 ) {
a --;
}
while ( a != 0 ) {
i = a;
while ( i % 5 == 0) {
i /= 5;
nr ++;
}
a -= 5;
}
g << ( P - nr ) * 5;
g << -1;
}
*/
if ( ( P + 1 ) % 6 == 0 ) {
g << -1;
} else while (true);
g << '\n';
return 0;
}