Topic links: Portal
【answer】:
Investigation and dfs prime factorisation, to open a first array of prime.
Parameters explanation:
1, the size of the current value. [N subject to the use of the control range]
2, control the lower bound, each time by one prime number to start the search, pos
3, the number of control, each time starting from a certain number of primes search.
4, the current value of the number of factors.
[Code]:
1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 typedef long long ll; 5 ll prime[ ] = { 0,2,3,5,7,11, 6 13,17,19,23,29, 7 31,37,41,43,47, 8 51}; 9 ll n ; 10 int T; 11 ll dfs( ll num , ll pos ,ll k , ll ans ){ 12 if( pos > 15 ) return 0; 13 ll res = ans ; 14 for(int i=1;i<=k;i++){ 15 if( n/prime[pos] < num ) break ; 16 num *= prime[pos] ; 17 res = max( res , dfs( num ,pos+1 , i , ans*(i+1) ) ); 18 } 19 return res; 20 } 21 int main() 22 { 23 scanf("%d",&T); 24 while(T--){ 25 scanf("%lld",&n); 26 ll ans = dfs(1ll,1,64,1); 27 printf("%lld\n",ans); 28 } 29 return 0; 30 }