HDU 3910 (13.10.31)
来源:互联网 发布:庆应大学知乎 编辑:程序博客网 时间:2024/06/11 06:31
Description
Maybe 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 many 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 exceptation.
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?
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 many 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 exceptation.
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?
Input
Several 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
Each test case 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, the expectation point that Alice can get. Round to 6 decimal points.
Sample Input
2 10 43 3 3
Sample Output
0.2000000.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 many points. Bob is clever, so he won’t do that.
参考题解:http://blog.csdn.net/ivan_zjj/article/details/7927970
AC代码
#include<stdio.h>int main() { double a, b, c; while(scanf("%lf %lf %lf", &a, &b, &c) == 3) { double ans = (a*b - c*c) / (a + b + 2*c); printf("%.6lf\n", ans); } return 0;}
- HDU 3910 (13.10.31)
- HDU 4455 (13.10.31)
- hdu 3910
- hdu 3910 两国杀
- HDU 1013 (13.10.29)
- HDU 4500 (13.07.31)
- HDU 4510 (13.07.31)
- HDU 4508 (13.07.31)
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- 基于HTML5的可预览多图片Ajax上传
- Java 获取指定日期的实现方法总结
- 分享一个水波纹动画效果的实现
- 计算机程序语言中各种包的运用(java)
- Cocos2d-x学习之---自定义图标(带触摸事件)
- HDU 3910 (13.10.31)
- CODE 100: Search in Rotated Sorted Array
- Axis2(一):配置指导
- NSDateFormatter
- 微信公共平台入门
- 几个主流的Java连接池
- 图解 MongoDB 地理位置索引的实现原理
- 【Python】基于kNN算法的手写识别系统的实现与分类器测试
- 关于什么是数据分析