首页 > 代码库 > hdu 5981 Guess the number
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
Problem Description
AOA just met a problem when he attended an interview, as shown below:
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?
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?
Input
Input contains multiple sets of test data and each of them occupies one line,including two integersa, b(1≤a≤b≤5 * 10^6),on behalf of range of the number.Input to the end of the file.
Output
For each set of input, output one line containing two integers. The first one represents the least number of times of guessing in the worst situation. The second one represents the number of best guess method modulo 100000073.
Sample Input
1 5
Sample Output
3 3
Hint
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.
Source
2016ACM/ICPC亚洲区大连站-重现赛(感谢大连海事大学)
Recommend
hdu 5981 Guess the number
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。