本文是ACM练习题 Head-to-Head Match 的解答
Head-to-Head Match
Our school is planning to hold a new exciting computer programming contest. During each round of the contest, the competitors will be paired, and compete head-to-head. The loser will be eliminated, and the winner will advance to next round. It proceeds until there is only one competitor left, who is the champion. In a certain round, if the number of the remaining competitors is not even, one of them will be chosed randomly to advance to next round automatically, and then the others will be paired and fight as usual. The contest committee want to know how many rounds is needed to produce to champion, then they could prepare enough problems for the contest.
Input
The input consists of several test cases. Each case consists of a single line containing a integer N - the number of the competitors in total. 1 <= N <= 2,147,483,647. An input with 0(zero) signals the end of the input, which should not be processed.
Output
For each test case, output the number of rounds needed in the contest, on a single line.
Sample Input
8
浙江大学ACM试题解答? 浙江大学ACM试题解答(四月) --- Crashing Balloon ---...
ACM试题解析-1_电脑基础知识_IT/计算机_专业资料。2003 年 ACM-ICPC 南太平洋赛区试题解析-1 ACM 国际大学生程序设计竞赛由国际计算机学界著名的 ACM 学会(Associat...
对于数据的输入和输出有几道练习题 http://acm.hdu.edu.cn/showproblem.php?pid=1089 至 http://acm.hdu.edu.cn/showproblem.php?pid=1096 二、算法基础 ...
ACM解题思路介绍ACM解题思路介绍隐藏>> ACM 习题集锦三 电子科技大学 文成明 1032 Background Area 2 Being well known for its highly innovative products, Merck...
ACM练习 10页 1财富值 acm集训练习 12页 免费 acm练习5 10页 2财富值 ACM练习建议 10页 1财富值 Acm习题 7页 免费喜欢此文档的还喜欢 C语言竞赛题目大全 ...
ACM习题集锦一_IT/计算机_专业资料。ACM大赛解题方法ACM 习题集锦一 电子科技大学 文成明 1013 Great Equipment Once upon a time, there lived Catherine Ironfist...
部分ACM题解析_IT认证_资格考试/认证_教育专区。部分ACM练习题描述 从键盘输入若干个数,然后求出他们的和 输入第一行首先输入一个整数n,然后第二行有n个整数,当...
ACM练习题_IT/计算机_专业资料。本人收集的各种ACM练习题!!!绝对绝无仅有!!!赶紧下载收藏吧!!!ACM 练习题(1)描述 浙江工商大学校园里绿树成荫,环境非常舒适,因此...
ACM练习题分类表_理学_高等教育_教育专区。ACM,算法,竞赛,程序设计,信息学ACM练习题分类表 请所有的新队员认真完成以下各题。如果做题遇到困难,如题意难以理解、不...
ACM练习题_IT认证_资格考试/认证_教育专区。ACM 练习题 ZDM 一、 高精度运算 Propram 1: Input file: t1.in X+Y , X-Y Output file: t1.out Time lim...
热门文档