"BZOJ2729" "HNOI2012" queueing combination number theory Python high precision

Source: Internet
Author: User

Reprint Please specify the source Thank you: http://blog.csdn.net/vmurder/article/details/42964151

Exercises

There is a comment inside the code.

Attention:

Chinese characters in Python2 even if commented, ce (of course, because Python is run directly, not compiled, so show WA)

Well, the local Python3 doesn't care about it.


So my code needs to delete the Chinese note and 233.


Code:

# n! (A (n+1,2) *a (n+3,m) +2* (n+1) *a (n+2,m-1) *m) # First the boys casually put this is the n! kind of pendulum method. # and then add two teachers, there is a n+3 put the girl's position, # is the girl has a (n+3,m) species, but the teacher's position should be a (n+1,2) # and then if the two teachers throw to the boys when repeated, then need to insert a girl in the middle # that is, girls have a (n+2,m-1) species interpolation method , and the teacher is (n+1) method, # Note at this time need to enumerate which girl was placed in the middle of the teacher, there is a case of M. #呃, two teachers are also different, so at this time need to *2# the two teachers of the law is not repeated and includes all the circumstances of the # that we again like the above treatment two kinds of teachers when the number of girls ranked # can be solved and include all cases. # by yGY (id:18357) def mul (x, y): Re = 1for i in range (x, y + 1): Re = re * Ireturn ren, m = raw_input (). Split () n = int (n); m = Int (m) #print (Mul (1,n) * ((n+1) *n*mul (n+3-m+1,n+3) +2* (n+1) *m*mul (n+2-m+2,n+2)) print (Mul (1,n+1) *mul (n+4-m,n+2) * (N (n+3) +2*m))



"BZOJ2729" "HNOI2012" queueing combination number theory Python high precision

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.