淘汰赛问题题目:Our school is pl

21 查阅
淘汰赛问题题目:Our school is planning to hold a new exciting computer programming contest. During each roun

参考答案:

正确答案:

\r\n

其实就是计算一个数是2的几次方。
#include <iostream>
using namespace std;
long calculate(long test)
{
long ret = 0;
bool is2square = true;
while(test!=1)
{
if(test % 2)
is2square = false;
test /= 2;