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> ...
随机推荐
- console.log是异步么?
让我们来看一个例子: var a = {}; console.log(a); a.foo = 'foo'; 4 console.log(a); 但是问题来了:在chorme跟firfox一样么? 结果 ...
- TP5之页面跳转样式
1.效果图 2.上干货 为了增加对移动设备的支持,在 /application/common.php加入以下函数: function isMobile() { if (isset ($_SERVER ...
- 51nod 1049【经典】
自己模拟,全靠体会~ #include <cstdio> #include <stack> #include <iostream> #include <str ...
- TRANSFORM_TEX
Shader "Custom/Exam1" { Properties { _MainTex ("Texture", 2D) = "white" ...
- ugui batches
先渲染非重叠,然后渲染重叠 如果两个图不是同一个图集,并且都不重叠,那么按节点挂载顺序渲染 节点挂接多复杂没关系,关键是节点在Canvas下的顺序,绑在同一节点或者全部绑在根节点Canvas下渲染 ...
- [HNOI2010] 物品调度 fsk
标签:链表+数论知识. 题解: 对于这道题,其实就是两个问题的拼凑,我们分开来看. 首先要求xi与yi.这个可以发现,x每增加1,则pos增加d:y每增加1,则pos增加1.然后,我们把x与y分别写在 ...
- 【OpenJ_Bailian - 4005】拼点游戏(贪心)
拼点游戏 Descriptions: C和S两位同学一起玩拼点游戏.有一堆白色卡牌和一堆蓝色卡牌,每张卡牌上写了一个整数点数.C随机抽取n张白色卡牌,S随机抽取n张蓝色卡牌,他们进行n回合拼点,每次两 ...
- seq(2018.10.24)
一道\(dp\)题... 期望\(40\)分解法 预处理:离散化,然后让连续一段值相同的元素合并为一个元素. 正式\(DP\): 显然有个最差策略为每个元素处都切一次,则切的次数为元素的个数\(-1\ ...
- G - You Are the One(需要重想一遍)
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> ...
- Linux (三)
chmod :用来改变文件或目录的访问权限 语法格式:chmod [参数选项] [mode][文件或者目录] 参数选项: -v :显示权限变更的详细信息 -R :对当前目录下的所有文件以及子目录进行相 ...