Pagini recente » Cod sursa (job #1001582) | Cod sursa (job #1826894) | Cod sursa (job #977254) | Cod sursa (job #2432922) | Cod sursa (job #1238324)
#include <fstream>
using namespace std;
int N, sol;
ifstream fin("fact.in");
ofstream fout("fact.out");
bool Check(int val) {
int count = 0;
for (int fact = 5; fact <= val; fact *= 5)
count += val / fact;
if (count < N)
return true;
return false;
}
int main() {
fin >> N;
for (int bit = 1 << 9; bit; bit >>= 1) {
if (Check(sol | bit))
sol |= bit;
}
fout << sol + 1 << "\n";
return 0;
}