Application of POJ2992 Divisors factors and number of factors

Source: Internet
Author: User

The question rate of this question is not very high, only less than 30%, the number is very big, it looks scary,

Because k and n are very large, it is impossible to calculate the number of combinations. Therefore, we need to first calculate the number of approx, because the number of combinations is actually in the form of formulas that can be written as factorial, we must first perform prime factor decomposition on the factorial.

1. Check the data range of the question and select a Prime Number of less than 500.

2. Then, we perform prime factor decomposition on every factorial.

3. Find the prime factor decomposition of the combination, and then you can get the number of approx;


# Include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
# Include
     
      
# Include
      
        # Include
       
         # Include
        # Include
         
           # Include
          
            # Include
           
             # Include
            
              # Define ll long # define eps 1e-8 # define inf 0 xfffffffconst ll INF = 1ll <61; using namespace std; // vector
             
               > G; // typedef pair
              
                P; // vector
               
                 >:: Iterator iter; // map
                
                  Mp; // map
                 
                   : Iterator p; // bool vis [502]; int a [102], cnt; int divide [502] [102]; ll ans [502] [502]; void clear () {memset (divide, 0, sizeof (divide); memset (ans, 0, sizeof (ans); memset (vis, false, sizeof (vis); memset (a, 0, sizeof (a); cnt = 0;} void init () {clear (); vis [0] = vis [1] = false; for (int I = 2; I <500; I ++) {if (! Vis [I]) a [cnt ++] = I; for (int j = 0; j
                  
                    > N> k) {if (k = 0 | n = k) {puts ("1"); continue;} cout <
                   

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.