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

建议使用的浏览器:

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

3994:Probability One

题目描述
Number guessing is a popular game between elementary-school kids. Teachers encourage pupils to play the game as it enhances their arithmetic skills, logical thinking, and following-up simple procedures. We think that, most probably, you too will master in few minutes. Here’s one example of how you too can play this game: Ask a friend to think of a number, let’s call it n0. Then:

  1. Ask your friend to compute n1 = 3 * n0 and to tell you if n1 is even or odd.

  2. If n1 is even, ask your friend to compute n2 = n1/2. If, otherwise, n1 was odd then let your friend compute n2 = (n1 + 1)/2.

  3. Now ask your friend to calculate n3 = 3 * n2.

  4. Ask your friend to tell tell you the result of n4 = n3/9. (n4 is the quotient of the division operation. In computer lingo, ’/’ is the integer-division operator.)

  5. Now you can simply reveal the original number by calculating n0 = 2 * n4 if n1 was even, or n0 = 2 * n4 + 1 otherwise.


Here’s an example that you can follow: If n0 = 37, then n1 = 111 which is odd. Now we can calculate n2 = 56, n3 = 168, and n4 = 18, which is what your friend will tell you. Doing the calculation 2 * n4 + 1 = 37 reveals n0.
输入解释
Your program will be tested on one or more test cases. Each test case is made of a single positive number (0 < n0 < 1,000,000).
The last line of the input file has a single zero (which is not part of the test cases.)
输出解释
For each test case, print the following line:
k. B Q
Where k is the test case number (starting at one,) B is either ’even’ or ’odd’ (without the quotes) depending on your friend’s answer in step 1. Q is your friend’s answer to step 4.
输入样例
37
38
0
输出样例
1. odd 18
2. even 19

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 anarc 2009

源链接: POJ-3994

最后修改于 2020-10-29T07:17:44+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536