#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n;
int p[9] = {2,3,5,7,11,13,17,19,23};
int min_num = INT_MAX, max_s;
void dfs(int u, int last, int num, int s)
{
if(s > max_s || s == max_s && num < min_num)
{
max_s = s;
min_num = num;
}
if(u >= 9) return;
LL mi = 1;
for(int i = 1; i <= last; i++)
{
mi *= p[u];
if(num * mi > n) break;
dfs(u+1, i, num * mi, s * (i+1));
}
}
int main()
{
cin >> n;
dfs(0, 30, 1, 1);
cout << min_num;
return 0;
}
逻辑结构:
栈(Stack)是一种遵循后进先出(LIFO, Last In First Out)原则的有序集合 (受限的线性表)。这种数据结构只允许在栈顶进行添加(push)或删除(pop&…