Acm hdu 3910 Liang Guo Sha (mathematical questions, understanding questions)

Source: Internet
Author: User
Liang Guo Sha

Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 214 accepted submission (s): 162

Problem descriptionmaybe you know "San Guo Sha", but I guess you didn't hear the game: "Liang Guo Sha "!

Let me introduce this game to you. unlike "San Guo Sha" with its complicated rules, "Liang Guo Sha" is a simple game, it consists only four cards, two cards named "Sha ", and the other named "Shan ".

Alice and Bob are good friends, and they're playing "Liang Guo Sha" now. everyone has two cards: A "Sha" and a "Shan ". each round, Everyone choose a card of his/her own, and show it together (just show the selected card, do not need to put it away ). if both of them choose "Sha", then Alice gets a Points , and Bob loses a Points ; if both of them choose" Shan ", then Alice gets B Points , and Bob loses B Points ; otherwise, Bob gets C Points , and Alice loses C Points .

Both Alice and Bob wants to get points as ready as possible, they thought a optimal strategy: calculating a percentage of Choosing Card "Sha" in order to ensure that even the opponent uses the optimal strategy, he/she can still get a highest point into tation.

Here is the question, if both Alice and Bob use the optimal strategy to make their points higher, what is the expectation point which Alice can get in a round?

Inputseveral test case, process to EOF.
Each test case has only a line, consists three positive integers: A, B, C respectively.
1 <= a, B, c <= 100000

Outputeach test case just need to output one line, the expectation point that Alice can get. Round to 6 decimal points.

Sample input2 10 4 3 3 3

Sample output0.200000 0.000000

Hint

In Test Case 1, both Alice and Bob calculated the best percentage of choosing "Sha", and the their percentage are the same: 70%. if Bob do not choose the best percentage, his strategy might be targetd. for example, if Bob choose 100%, then Alice can change her percentage to 100%, Bob might lose into points. bob is clever, so he won't do that.

 

Source2011 multi-university training contest 8-host by HUST

Recommendlcy The question is hard to understand. In fact, it is easy to figure it out. That is, the mathematical expectation of one person's score should not be influenced by another person! Set Alice has the probability of Sha X, and Bob has the probability of Sha y. Alice's mathematical expectation is: X * y * A + () * (1-y) * B-x * (1-y) * C-y * () * C = () * B-x * C + (x * A-() * B + x * C-() * C) y If the coefficient of Y is 0, x can be obtained, X = (B + C)/(A + B + 2 * C) Therefore, the mathematical expectation is:(_X) * B-x * C Program:

 # Include  <  Stdio. h  >  
Int Main ()
{
Int A, B, C;
While (Scanf ( " % D " , & A, & B, & C) ! = EOF)
{
Double X = ( Double ) (B + C) / ( + B + C * 2 );
Printf ( " %. 6lf \ n " ,( 1 - X) * B - X * C );
}
Return 0 ;
}

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.