#include <iostream>
#include <math.h>
using namespace std;
bool not_prime[32000];
int prime[32000];
int c=0;
int ikun[32000][2];
int n;
int ans;
int dfs(){
ans=min(ans,n);
for (int i=1;i<=c;i++){
for (int j=1;j<=c;j++){
if (j==i) continue;
if (ikun[j][1]==0) continue;
for (int k=1;k<=ikun[i][1];k++){
for (int l=1;l<=ikun[j][1];l++){
n/=pow(ikun[i][0],k);
n/=pow(ikun[j][0],l);
ikun[i][1]-=k;
ikun[j][1]-=l;
dfs();
n*=pow(ikun[i][0],k);
n*=pow(ikun[j][0],l);
ikun[i][1]+=k;
ikun[j][1]+=l;
}
}
}
}
}
void p(int a){
int ooo=sqrt(a);
for (int i=2;i<=ooo;i++){
if(prime[i]){
if (a%i==0){
c++;
ikun[c][0]=i;
}
while (a%i==0){
ikun[c][1]++;
a/=i;
}
}
}
}
int main(){
int tot=0;
cin>>n;
ans=n;
for (int i=2;i<=32000;i++){
if (!not_prime[i]) prime[++tot]=i;
for (int j=1;j<=tot&&i*prime[j]<=32000;j++){
not_prime[i*prime[j]]=true;
if (i%prime[j]==0) break;
}
}
p(n);
dfs();
cout<<ans;
return 0;
}
我知道这是错误的代码,但随便输个数在我电脑上都秒出,为啥在洛谷tle呢?