hdu 5981 Guess the number
Guess the number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 160000/160000 K (Java/Others)
Total Submission(s): 163 Accepted Submission(s): 60
A and B two people play guessing games. A thinks of a number x between a and b randomly in his mind, and he lets B to guess this number. A will say too small if B’s guess is less than x and A will say yes if B’s guess is just x.Once B’sguess is bigger than x,A won't speak any more.After that,A just nods his head if B’s guess is just x,otherwise shakes his head.The problem is that how many kinds of best guess strategies to make the least number of guesses in the worst situation?
B can guess the number in A's mind up to 3 times in the worst case.
The first method,B can guess in the order of (2,4,5)
The second method,B can guess in the order of (3,4,5)
The third method,B can guess in the order of (3,5)
Each method is up to three times.
hdu 5981 Guess the number的更多相关文章
- HDU.1394 Minimum Inversion Number (线段树 单点更新 区间求和 逆序对)
HDU.1394 Minimum Inversion Number (线段树 单点更新 区间求和 逆序对) 题意分析 给出n个数的序列,a1,a2,a3--an,ai∈[0,n-1],求环序列中逆序对 ...
- hdu 6216 A Cubic number and A Cubic Number【数学题】
hdu 6216 A Cubic number and A Cubic Number[数学] 题意:判断一个素数是否是两个立方数之差,就是验差分.. 题解:只有相邻两立方数之差才可能,,因为x^3-y ...
- HDU 1394 Minimum Inversion Number(线段树求最小逆序数对)
HDU 1394 Minimum Inversion Number(线段树求最小逆序数对) ACM 题目地址:HDU 1394 Minimum Inversion Number 题意: 给一个序列由 ...
- HDU 6093 - Rikka with Number | 2017 Multi-University Training Contest 5
JAVA+大数搞了一遍- - 不是很麻烦- - /* HDU 6093 - Rikka with Number [ 进制转换,康托展开,大数 ] | 2017 Multi-University Tra ...
- ACM-ICPC 2016 大连赛区现场赛 K. Guess the number && HDU 5981(思维+DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5981 题意:A在[L, R]之间随机选取一个数X,之后B来猜这个数,如果猜的数比X小,那么A就告诉B猜 ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1394 Minimum Inversion Number ( 树状数组求逆序数 )
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1394 Minimum Inversion Number ...
- HDU 1394 Minimum Inversion Number(线段树/树状数组求逆序数)
Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- 【HDU 3709】 Balanced Number (数位DP)
Balanced Number Problem Description A balanced number is a non-negative integer that can be balanced ...
随机推荐
- IO 之 File 类
位于 java.io 包 用来将文件或者文件夹封装成对象 方便对文件和文件夹的属性信息进行操作 File 对象可以作为参数传递给流的构造函数 构造函数 // 可以将一个已存在的, 或者不存在的文件或者 ...
- CMDB初步了解
本节内容 浅谈ITIL CMDB介绍 Django自定义用户认证 Restful 规范 资产管理功能开发 浅谈ITIL TIL即IT基础架构库(Information Technology Infra ...
- Shell正则表达式和文本处理工具
作业一:整理正则表达式博客 一.什么是正则 正则就是用一些具有特殊含义的符号组合而成(称为正则表达式)来描述字符或者字符串的方法.或者说:正则就是用来描述一类事物的规则. 通配符是由shell解释得. ...
- 解决 apt-get the following packages has unmet dependencies 问题
安装vpn遇到以下问题: 显示flinux print util和openconnect存在依赖库的冲突 此时尝试安装新的tk.vpnc-scripts.libopenconnect5,尝试apt-g ...
- JS产品分类列表练习
CSS: ;;} ul,li{list-style: none;} body{color: #666;background: #f5f5f5;} a{text-decoration: none;col ...
- java中byte[] 和16进制字符串互转
//将byte[]转换为16进制字符串 public static String byte2hex(byte[] b) { StringBuilder hs = new StringBuilder() ...
- Pandas 删除指定列中为NaN的行
定位要删除的行 需求:删除指定列中NaN所在行. 如下图,’open‘ 列中有一行为NaN,定位到它,然后删除. 定位: df[np.isnan(df['open'])].index # 这样即可定位 ...
- mysql建立索引 删除索引
建立索引 1.添加PRIMARY KEY(主键索引) mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) 2.添加UNIQUE ...
- 我们是80后 golang入坑系列
现在这个系列,已经开始两极分化了. 点赞的认为风格轻松,看着不困.反之,就有人嫌写的罗里吧嗦,上纲上线.所以善意提醒,里面不只是技术语言,还有段子.专心看技术的,千万别点!别怪我没提醒!差点忘说,版权 ...
- corethink功能模块探索开发(十四)后台编辑按钮
效果图: 1.添加下图55&58行代码 2.实现edit方法 位于Equip/Admin/DeviceRepaireAdmin.class.php中 public function edit( ...