现在的位置: 首页 > 综合 > 正文

zoj 2722 Head-to-Head Match

2012年12月06日 ⁄ 综合 ⁄ 共 164字 ⁄ 字号 评论关闭
#include "iostream"
using namespace std;

int main()
{
	int num; 
	while (cin >> num && num)
	{
		int count = 0, temp = 0;
		while (num != 1)
		{
			temp = num % 2;
			num /= 2;
			num += temp;
			count++;
		}
		    cout << count << endl;
	}
}

 

抱歉!评论已关闭.