`
rex686568
  • 浏览: 9051 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

正整数排序 Help is need for Dexter Uva 11384

 
阅读更多

面对刚开始没有头绪的题目, 先进行尝试往往是非常有必要的,

#include <cstdio>
#include <iostream>

using namespace std;

unsigned int cal(unsigned int n){
	if (n == 1) return 0;
	else if (n == 2) return 1;
	else return cal((unsigned int)(n/2))+1;
}

int main(){

	unsigned int n;
	cin >> n;
	cout << cal(n);
	return 0;
}


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics