比赛 NOIP2023模拟赛5 评测结果 AAAAAAAAAAAAAAAAAAAAAA
题目名称 Number With The Given Amount Of Divisors 最终得分 100
用户昵称 Murasame 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2023-11-17 11:28:54
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int pr[]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};
int n;
ll ans=0x7f7f7f7f7f7f7f7f;
void work(int prloc,int expon,int cnt,ll anss){
	if(prloc>16||anss>ans||anss<=0||cnt>n){
		return;
	}
	if(cnt==n){
		ans=min(ans,anss);
		return;
	}
	for(int i=1;i<=expon;i++){
		work(prloc+1,i,cnt*(i+1),anss*=pr[prloc]);
	}
}
int main(){
	freopen("CF27E.in","r",stdin);
	freopen("CF27E.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	work(1,64,1,1);
	cout<<ans<<endl;
	return 0;
}