Description
For any positive integer x, the number of its approximate numbers is recorded as g (x). For example G (1) =1, g (6) = 4.
If a positive integer x satisfies: g (x) >g (i) 0<i<x, it is said that X is an inverse prime number. For example, integer 1,2,4,6, etc. are all anti-prime.
Now given a number n, can you find the largest anti-prime that does not exceed n?
Input
A number N (1<=n<=2,000,000,000).
Output
The maximum number of anti-prime numbers not exceeding N.
Sample Input +Sample Output840They say there are no more than 12 2*10^9 in the number of factors that match the condition.Hit the table and go straight to the search.
1#include <cstdio>2 #definell Long Long3 intpre[ the]={1,2,3,5,7, One, -, -, +, at, in, to};4 intN;5 ll Ans,num;6 voidDfsintK,ll Now,ll CNT,intLast ) {7 if(k== A){8 if(Now>ans&&cnt>num) {ans=now;num=cnt;return;}9 if(Now<=ans&&cnt>=num) {ans=now;num=cnt;return;}Ten return; One } All t=1; - for(intI=0; i<=last;i++){ -DFS (k +1, now*t,cnt* (last+1), i); thet*=Pre[k]; - if(now*t>n)return; - } - } + - + intMain () { Ascanf"%d",&n); atDfs1,1,1, -); -printf"%lld", ans); - } -
"Bzoj 1053" [HAOI2007] inverse prime ant