1653: Champion of the Swordsmanship
1653: Champion of the Swordsmanship
Time Limit: 1 Sec Memory Limit: 64 MB
Submit: 11 Solved: 8
[Submit][Status][Web Board]
Description
In Zhejiang University, there is a famous BBS named Freecity. Usually we call it 88.

Recently some students at the Humour board on 88 create a new game - Swordsmanship. Different from the common sword fights, this game can be held with three players playing together in a match. Only one player advances from the match while the other two are eliminated. Sometimes they also hold a two-player match if needed, but they always try to hold the tournament with as less matches as possible.
(最近,一些学生在幽默板上创造了一个新的游戏——剑术。与普通的剑战不同,这款游戏可以与三名玩家在一场比赛中一起玩。只有一名球员在比赛中取得进步,而另外两名则被淘汰。有时,如果需要的话,他们也会举办双人赛,但他们总是尽量少赛。)Input
The input contains several test cases. Each case is specified by one positive integer n (0 < n < 1000000000), indicating the number of players. Input is terminated by n=0.
Output
For each test case, output a single line with the least number of matches needed to decide the champion.
Sample Input
3
4
0
Sample Output
1
2
#include<stdio.h>
int main()
{
int n,m,k;
while(scanf("%d",&n)&&n!=0)
{
if(n%2==0)
printf("%d\n",n/2);
else
printf("%d\n",(n-1)/2);
}
}
1653: Champion of the Swordsmanship的更多相关文章
- zoj 2830 Champion of the Swordsmanship
Champion of the Swordsmanship Time Limit: 2 Seconds Memory Limit: 65536 KB In Zhejiang Universi ...
- 1653: [Usaco2006 Feb]Backward Digit Sums
1653: [Usaco2006 Feb]Backward Digit Sums Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 285 Solved: ...
- CodeForces - 1087F:Rock-Paper-Scissors Champion(set&数状数组)
n players are going to play a rock-paper-scissors tournament. As you probably know, in a one-on-one ...
- 【BZOJ】1653: [Usaco2006 Feb]Backward Digit Sums(暴力)
http://www.lydsy.com/JudgeOnline/problem.php?id=1653 看了题解才会的..T_T 我们直接枚举每一种情况(这里用next_permutation,全排 ...
- 2017南宁现场赛E The Champion
Bob is attending a chess competition. Now the competition is in the knockout phase. There are 2^r2r ...
- we are the champion!!!!
- 2015 "BestCoder Cup" Champion
这场比赛我没有参加,不过就算参加了也估计是被完虐.于是看着题解把大部分题目都搞了一遍. T1:Movie(hdu 5214) 题目大意: 给出N个区间,问能否选出3个互不相交的区间. N<=10 ...
- 种树 (codevs 1653) 题解
[问题描述] 一条街的一边有几座房子.因为环保原因居民想要在路边种些树.路边的地区被分割成块,并被编号为1..n.每个块大小为一个单位尺寸并最多可种一棵树.每个居民想在门前种些树并指定了三个号码b,e ...
- BZOJ 1653 [Usaco2006 Feb]Backward Digit Sums ——搜索
[题目分析] 劳逸结合好了. 杨辉三角+暴搜. [代码] #include <cstdio> #include <cstring> #include <cmath> ...
随机推荐
- oop的三大特点
1.封装性:也称为信息隐藏,就是将一个类的使用和实现分开,只保留部分接口和方法与外部联系,或者说只公开了一些供开发人员使用的方法.于是开发人员只 需要关注这个类如何使用,而不用去关心其具体的实现过程, ...
- 安装MySQL出现1045错误
安装MySQL出现1045错误 一.运行环境 MySQL mysql-5.1.26-rc-win32 操作系统:Windows 7 X64 二.问题描述 安装MySQL过程中会涉及对root密码的设置 ...
- Shader第十三讲 Alpha混合
http://blog.sina.com.cn/s/blog_471132920101d8z5.html Alpha Blending,中文译作Alpha混合Blending就是控制透明的.处于光栅化 ...
- P4463 [国家集训队] calc(拉格朗日插值)
传送门 设\(dp[i][j]\)为考虑\(i\)个数,其中最大值不超过\(j\)的答案,那么转移为\[dp[i][j]=dp[i-1][j-1]\times i\times j+dp[i][j-1] ...
- tpc-ds99 工具使用
安装部署 tpc-ds-99 工具 解压文件 unzip tpc-ds-tool.zip 进入目录 cd v2.3.0/tools 拷贝Makefile文件 cp Makefile.suite Mak ...
- C#求圆的周长、面积、体积
窗体应用程序 private void button1_Click(object sender, EventArgs e) { double r; r = Convert.ToInt32(textBo ...
- __next__,__iter__实现迭代器,斐波那契数列
迭代器__next__,__iter__ 基于__next__和__iter__方法实现的迭代器 class Foo: def __init__(self,n): self.n = n def __i ...
- dubbo属性配置
一.覆盖策略 JVM启动-D参数优先,这样可以使用户在部署和启动时进行参数重写,比如在启动时需改变协议的端口.XML次之,如果在XML中有配置,则dubbo.properties中的相应配置项无效.P ...
- F. Bakkar In The Army 二分
http://codeforces.com/gym/100283/problem/F 思路是二分第几行,二分出来的行是总和 >= n的,那么第k - 1行一定要选,那么再在第k行中二分那一列. ...
- Android -Cannot run program "XXX/sdk/tools/emulator": error=2, No such file or directory
I have installed android SDK and eclipse successfully on ubuntu 14.04. However,now it's not running. ...