Hdu4762 (mathematical probability)

Source: Internet
Author: User
Cut the cake Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 885 accepted submission (s): 432


Problem descriptionmmm got a big cake, and invited all her m friends to eat the cake together. surprisingly one of her friends Hz took some (n) strawberries which Mmm likes very much to decorate the cake (of course they also eat strawberries, not just for decoration ). hz is in charge of the decoration, and he thinks that it's not a big deal that he put the strawberries on the cake randomly One by one. after that, mmm wocould cut the cake into M pieces of sector with equal size and shape (the last one came to the party will have no cake to eat), and choose one piece first. mmm wants to know the probability that she can get all N strawberries, can you help her? As the cake is so big, all strawberries on it cocould be treat as points.
 
Inputfirst line is the integer T, which means there are t cases.
For each case, two integers m, n indicate the number of her friends and the number of strawberry.
(2 <m, n <= 20, T <= 400)
 
Outputas the probability cocould be very small, you shocould output the probability in the form of a fraction in lowest terms. for each case, output the probability in a single line. please see the sample for more details.
 
Sample Input
23 33 4
 
Sample output
1/34/27

Question: N strawberries. Divide the cake into M blocks. The probability that N strawberries are all in one cake
Idea: the formula is N/m ^ (n-1), which can be calculated by multiplication of large numbers.

Hdu4762 (mathematical probability)

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.