Algorithm title: Hdu 3910 Liang Guo Sha

Source: Internet
Author: User

Problem Description

Maybe you know "San Guo sha", but I guess you didn ' t hear the game: "Liang Guo sha"!

Let me introduce this game. Unlike "San Guo Sha" with its complicated rules, "Liang Guo sha" are 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. his/her own, and show it Together (Just show the selected. 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 many as possible, they thought a optimal strategy:calculating a percentage of C Hoosing card "Sha" in order to ensure that even the opponent uses the optimal strategy, he/she can still get a highest NT Exceptation.

Here's the question, if both Alice and Bob use the optimal strategy to do their points, higher is the What Point which Alice can get in a round?

Input

Several test case, process to EOF.

Each test case is has only a line, consists three positive integers:a, B, C respectively.

1 <= A, B, C <= 100000

Output

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

Sample Input

2 10 4

3 3 3

Sample Output

0.200000

0.000000

Hint

In test Case 1, both Alice and Bob calculated the best percentage of choosing "Sha", and the their percentage the are : 70%.

If Bob does not choose the best percentage, he strategy might be targetd.

For example, if Bob choose 100%, then Alice can change her percentage to 100%, Bob might lose many. Bob is clever, so he won ' t does that.

Reference to the http://blog.csdn.net/ivan_zjj/article/details/7927970

Topic both Alice and Bob wants to get points as many as possible, they thought a optimal strategy:calculating a percentage o F Choosing Card "Sha" in order to ensure that even the opponent uses the optimal strategy, he/she can still get a highest Point Exceptation.

is important

Code:

#include <stdio.h>
int main ()
{
    int a,b,c;
    while (scanf ("%d%d%d", &a,&b,&c)!=eof)
    {
        double x= (double) (b+c)/(a+b+c*2);
        printf ("%.6lf\n", (1-x) *b-x*c);
    }    
    return 0;
}

See more highlights of this column: http://www.bianceng.cn/Programming/sjjg/

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.