Probability One

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 379    Accepted Submission(s): 293

Problem Description
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.
 
Input
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.)
 
Output
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.
Note: There is a blank space before B.
 
Sample Input
37
38
0
 
Sample Output
1. odd 18
2. even 19
 
Source
 
Recommend
lcy   |   We have carefully selected several similar problems for you:  3351 3352 3353 3355 3356 
 
 //0MS    228K    366 B    G++
/* 题意:
题目看似很难.其实是水题.直接按它的过程计算一遍即可得出解 */
#include<stdio.h>
int main(void)
{
int n;
int k=;
while(scanf("%d",&n),n)
{
int odd=;
n*=;
if(n%){
odd=;
n=(n+)/;
}else n/=;
n*=;
n/=;
if(odd) printf("%d. odd %d\n",k++,n);
else printf("%d. even %d\n",k++,n);
}
return ;
}

hdu 3354 Probability One的更多相关文章

  1. HDU 2131 Probability

    http://acm.hdu.edu.cn/showproblem.php?pid=2131 Problem Description Mickey is interested in probabili ...

  2. HDU 4978 A simple probability problem

    A simple probability problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

  3. HDU 6595 Everything Is Generated In Equal Probability (期望dp,线性推导)

    Everything Is Generated In Equal Probability \[ Time Limit: 1000 ms\quad Memory Limit: 131072 kB \] ...

  4. hdu多校第二场 1005 (hdu6595) Everything Is Generated In Equal Probability

    题意: 给定一个N,随机从[1,N]里产生一个n,然后随机产生一个n个数的全排列,求出n的逆序数对的数量,加到cnt里,然后随机地取出这个全排列中的一个非连续子序列(注意这个子序列可以是原序列),再求 ...

  5. hdu 2955 01背包

    http://acm.hdu.edu.cn/showproblem.php?pid=2955 如果认为:1-P是背包的容量,n是物品的个数,sum是所有物品的总价值,条件就是装入背包的物品的体积和不能 ...

  6. HDU 2955 Robberies 背包概率DP

    A - Robberies Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submi ...

  7. HDU 4816 Bathysphere(数学)(2013 Asia Regional Changchun)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 Problem Description The Bathysphere is a spheric ...

  8. HDU 3076:ssworld VS DDD(概率DP)

    http://acm.split.hdu.edu.cn/showproblem.php?pid=3076 ssworld VS DDD Problem Description   One day, s ...

  9. HDU 3853:LOOPS(概率DP)

    http://acm.split.hdu.edu.cn/showproblem.php?pid=3853 LOOPS Problem Description   Akemi Homura is a M ...

随机推荐

  1. A的B次幂

    Description 给出两个正整数A和B 请输出A的B次幂 结果可能很大,请对1000000007求模 Input A和B,两个整数均不大于10^18 Output A的B次幂对100000000 ...

  2. Linux文件服务器实战(匿名用户)

    一.进程与线程 二.vsftp服务器 1.文件传输协议(file transfer protocol,FTP) 基于该协议ftp客户端和服务端实现文件共享,上传下载文件 FTP基于TCP协议生成一个虚 ...

  3. python导包学习总结

    python初学者,对于导包纠结了不少时间,总结分享,持续前进~ Python导包的两种方法: 1.1  from 包.模块  import 方法名,调用时直接使用方法名() 1.2  from 包. ...

  4. 基于WSAAsyncSelect模型的两台计算机之间的通信

    任务目标 编写Win32程序模拟实现基于WSAAsyncSelect模型的两台计算机之间的通信,要求编程实现服务器端与客户端之间双向数据传递.客户端向服务器端发送"请输出从1到1000内所有 ...

  5. Java web--过滤器

    本文引自:https://www.cnblogs.com/dudududu/p/8505177.html 参考博客:http://www.cnblogs.com/coderland/p/5902878 ...

  6. 原生js获取页面中所有checkbox

    var inputs = document.getElementsByTagName("input");//获取所有的input标签对象 var checkboxArray = [ ...

  7. Vue项目部署遇到的问题及解决方案

    写在前面 Vue-Router 有两种模式,默认是 hash 模式,另外一种是 history 模式. hash:也就是地址栏里的 # 符号.比如 http://www.example/#/hello ...

  8. 裸机——iNand

    1.先晓得iNand的基础知识 iNand是在SD卡基础上发展来的,而SD卡是在MMC的基础上发展来的,MMC是在Nand的基础上发展来的 我们晓得Nand的基础知识,而MMC对Nand大致做了两个改 ...

  9. 8,实例化Flask的参数 及 对app的配置

    Flask 是一个非常灵活且短小精干的web框架 , 那么灵活性从什么地方体现呢? 有一个神奇的东西叫 Flask配置 , 这个东西怎么用呢? 它能给我们带来怎么样的方便呢? 首先展示一下: from ...

  10. 2,Python常用库之二:Pandas

    Pandas是用于数据操纵和分析,建立在Numpy之上的.Pandas为Python带来了两种新的数据结构:Pandas Series和Pandas DataFrame,借助这两种数据结构,我们能够轻 ...