"Bzoj 1053" [HAOI2007] inverse prime ant

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.