Pagini recente » Cod sursa (job #880628) | Cod sursa (job #2987906) | Cod sursa (job #3264949) | Cod sursa (job #1338197) | 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;
}