< log250000 < 16, so will not select more than 16 prime numbers, and then violence to run DFS, high-precision calculation of the final answer:
------------------------------------------------------------------------------
#include <cstdio>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int MAXN = 50009;const int n = +;const int P[n] = {2, 3, 5, 7, one, A, N, a, A, a, a, a, a.int N, ans[n], g[n], ANSN;double cur = 1e30;void Dfs (int x, int lim, double res, int cnt) {if (res > cur) return;if (cnt = = N) {if (res < cur) {ansn = x;for (int i = 0; i < x; i++) ans[i] = G[i];cur = res;}} else {if (x = = n) return;for (int i = 0; I <= Lim; i++) if (CNT * (i + 1) <= N) {g[x] = i;DFS (x + 1, I, res + i * log (p[x]), CNT * (i + 1));}}}struct INT {static const int base = 10000;static const int width = 4;static const int MAXN = n;int S[MAXN], n;Int () {n = 0;memset (s, 0, sizeof s);}int (int x) {n = 0;For (; x; x/= base) s[n++] = x base;}int operator = (const int &o) {n = O.N;memcpy (S, O.S, sizeof (int) * n);return *this;}Int operator * (const int &o) Const {INT ret; RET.N = n + o.n-1;for (int i = 0; i < n; i++)For (int j = 0; J < O.N; J + +)Ret.s[i + j] + = s[i] * O.s[j];for (int i = 0; i < RET.N; i++) if (Ret.s[i] >= base) {Ret.s[i + 1] + = ret.s[i]/base;Ret.s[i]%= base;}for (int &i = RET.N; ret.s[i]; i++) if (Ret.s[i] >= base) {Ret.s[i + 1] + = ret.s[i]/base;Ret.s[i]%= base;}return ret;}void Write () {int buf[width], C;for (int i = n; i--;) {c = 0;for (int t = s[i]; t; t/=) buf[c++] = t%;if (i! = n-1)For (int j = width-c; j--;) Putchar (' 0 ');while (c--) Putchar (buf[c] + ' 0 ');}puts ("");}};int main () {scanf ("%d", &n);dfs (0, N-1, 0, 1);Int res = 1;for (int i = 0; i < ANSN; i++) {Int _p = p[i];For (int j = 0; J < Ans[i]; j + +)res = res * _P;}res.write ();return 0;}
------------------------------------------------------------------------------
1225: [HNOI2001] seeking positive integers Time Limit:Ten Sec Memory Limit:162 MB
Submit:576 Solved:232
[Submit] [Status] [Discuss] Description
For any input positive integer n, program to find a minimum positive integer m with n different factors. For example: n=4, then m=6, because 6 has 4 different integer factor 1,2,3,6, and is the smallest integer with 4 factors.
Input
N (1≤n≤50000)
Output
M
Sample Input 4Sample Output 6
HINT
Source
Dp
Bzoj 1225: [HNOI2001] Positive integer (DFS + high precision)