比赛 NOIP2023模拟赛5 评测结果 AAAAAAAAAAAAAAAAAAAAAA
题目名称 Number With The Given Amount Of Divisors 最终得分 100
用户昵称 op_组撒头屯 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2023-11-17 08:58:14
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll __int128
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define clr(f,n) memset(f,0,sizeof(int)*(n))
#define cpy(f,g,n) memcpy(f,g,sizeof(int)*(n))
const int N=1000+5;
const ll LIM=1e18;
int n,pri[]={0,2,3,5,7,11,13,17,19,23,29};
ll f[12][N];
int main(){
	freopen ("CF27E.in","r",stdin);
	freopen ("CF27E.out","w",stdout);
	scanf("%d",&n);
	for (int i=1;i<=n;i++)f[0][i]=LIM;
	f[0][1]=1;
	for (int i=1;i<=10;i++){
	    for (int j=1;j<=n;j++)f[i][j]=LIM;
	    for (int j=1;j<=n;j++){
	        ll p=f[i-1][j];
	        for (int k=0;j*(k+1)<=n&&p<=LIM;k++,p*=pri[i]){
	            f[i][j*(k+1)]=min(f[i][j*(k+1)],p);
            }
        }
    }
    printf("%lld\n",(long long)f[10][n]);
    return 0;
}