The conclusion was launched, and we never expected to use the final search ..
I also want dp ..
# Include <cstdio> # include <cstring> # include <iostream> # include <algorithm> # include <math. h ># include <set> # include <vector> # include <map> using namespace std; # define ll long # define N 1000005ll prime [N], primenum; // math has primenum prime numbers. hvoid PRIME (ll Max_Prime) {primenum = 0; prime [primenum ++] = 2; for (ll I = 3; I <= Max_Prime; I + = 2) for (ll j = 0; j <primenum; j ++) if (I % prime [j] = 0) break; else if (prime [j]> sqrt (double) I) | j = primenum-1) {prime [primenum ++] = I; break;} ll n, ans, sum; void dfs (ll a, ll s, ll t, ll l) {if (s> n <1) return; if (s = 2 * n | s = 2 * N-1) {ans = min (ans, a); return;} if (t> 20) return; for (ll I = 1; I <= l; I ++) {a * = prime [t]; dfs (a, s * (I + 1 ), t + 1, I) ;}} int main () {ll I, j, u, v; PRIME (100); while (cin> n, n) {ans = 1e18; dfs (,); cout <ans <endl;} return 0 ;}