当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2986:Ballot evaluation

题目描述
Before the 2009 elections at the European Parliament, Bill and Ted have asked their friends to make guesses about the outcome of the ballot. Now, the results have been published, so Bill and Ted want to check who was right. But checking the results of their many friends would take a very long time, and they need the evaluation to be done by a computer. Since they are not so good at programming, they ask you for help.
输入解释
The data provided by Bill and Ted has the following format: The first line consists of the number p of parties followed by the number g of guesses (with 1 ≤ p ≤ 50 and 1 ≤ g ≤ 10000). Then follow p lines, each line consisting of a unique party name of length ≤ 20 (only containing letters a-z, A-Z and digits 0-9) and the achieved vote percentage of this party with one digit after the decimal point. After the parties follow g lines, each consisting of a guess. A guess has the form P1 + P2 + ... + Pk COMP n, where P1 to Pk are party names, COMP is one of the comparison operators <, >, <=, >= or = and n is an integer between 0 and 100, inclusively. Each party name occurs at most once in each guess.

输出解释
For each guess, sum up the vote percentages of the parties and compare them with the specified integer n. Then, print a line stating whether the guess was correct. See the sample output for details.

输入样例
6 5
CDU 30.7
SPD 20.8
Gruene 12.1
FDP 11.0
DIELINKE 7.5
CSU 7.2
FDP > 11
CDU + SPD < 50
SPD + CSU >= 28
FDP + SPD + CDU <= 42
CDU + FDP + SPD + DIELINKE = 70
输出样例
Guess #1 was incorrect.
Guess #2 was incorrect.
Guess #3 was correct.
Guess #4 was incorrect.
Guess #5 was correct.

提示
Be careful with the comparison of floating point values, because some values in the input (like 0.1) do not have an exact representation 
as a floating point number. 
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2986

最后修改于 2020-10-25T22:58:57+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)