Rockethon2015 B Question Permutations rule + structure

Source: Internet
Author: User

Rockethon2015 B Question Permutations rule + structure

Question: Find the m column of the maximum given formula value.

Idea: if we know how to make the n-1 arrangement of f (p) the largest, we can put n on both sides of (n-1) for the n arrangement of f (p) the largest. Because n is placed on both sides of (n-1), the value added is

1 + 2 +... + n, if not placed on both sides, (n-1) to n N placement, for I, if m <2 ^ (n-i-1 ),

Then I will be placed at the pos, or it will be placed at the end of the executable, that is, the last position. Because (I + 1) must be on the left of I, and later than (I + 1) must be on the left of I. For details, see the code:

/*************************************** * ****************** File name: b. cpp author: kereo create time: ******************************** * ************************/# include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
# Include
     
      
# Include
      # Include
       
         # Include
        
          # Include
         
           # Include
          
            # Define deusing namespace std; typedef long ll; const int sigma_size = 26; const int N = 50 + 10; const int MAXN = 100000 + 50; const int inf = 0x3fffffff; const double eps = 1e-8; const int mod = 1000000000 + 7; # define L (x) (x <1) # define R (x) (x <1 | 1) # define PII pair
           
             # Define mk (x, y) make_pair (x), (y) int n; ll m; int ans [N]; ll base [N]; int main () {base [0] = 1; for (int I = 1; I
            
             

Related Article

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.