zoj2722
来源:互联网 发布:大学生在知乎怎么赚钱 编辑:程序博客网 时间:2024/05/21 14:01
题目大意:
一项比赛,给定competitors数量,如果是even,那么两两PK,胜者进入下一轮,如果非even,那么随机选一个进入下一轮,剩下的人两两PK。问需要多少轮可以选出champion。
解题思路:
看这个数是2的几次方向上取整就可以了
代码如下:
#include <iostream>#include <math.h>using namespace std;int main (){ long n; while(cin>>n&&n) { int round; round = ceil(log10((double)n)/log10(2.0)); cout<<round<<endl; } return 0;}
0 0
- zoj2722
- 大数据学习笔记之十 云计算、Web服务、网格计算的联系
- ORB-SLAM: A Versatile and Accurate Monocular SLAM Syetem 讲解 1
- 设计模式之代理模式
- LeetCode-Hash-438. Find All Anagrams in a String
- MongoDB与BSON
- zoj2722
- 紫书 例题 10-11 UVa11181
- angular的轮播
- SLAM系列之1 - ORB SLAM
- 在仅cpu模式下运行fast rcnn代码
- 学习笔记∣stm32l0xx时钟系统详解与代码配置
- 蓝牙HDP协议源码解析
- READING NOTE: YOLO9000: Better, Faster, Stronger
- ver0.83--preproc_data.m