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的更多相关文章

  1. zoj 2830 Champion of the Swordsmanship

    Champion of the Swordsmanship Time Limit: 2 Seconds      Memory Limit: 65536 KB In Zhejiang Universi ...

  2. 1653: [Usaco2006 Feb]Backward Digit Sums

    1653: [Usaco2006 Feb]Backward Digit Sums Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 285  Solved:  ...

  3. 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 ...

  4. 【BZOJ】1653: [Usaco2006 Feb]Backward Digit Sums(暴力)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1653 看了题解才会的..T_T 我们直接枚举每一种情况(这里用next_permutation,全排 ...

  5. 2017南宁现场赛E The Champion

    Bob is attending a chess competition. Now the competition is in the knockout phase. There are 2^r2r  ...

  6. we are the champion!!!!

  7. 2015 "BestCoder Cup" Champion

    这场比赛我没有参加,不过就算参加了也估计是被完虐.于是看着题解把大部分题目都搞了一遍. T1:Movie(hdu 5214) 题目大意: 给出N个区间,问能否选出3个互不相交的区间. N<=10 ...

  8. 种树 (codevs 1653) 题解

    [问题描述] 一条街的一边有几座房子.因为环保原因居民想要在路边种些树.路边的地区被分割成块,并被编号为1..n.每个块大小为一个单位尺寸并最多可种一棵树.每个居民想在门前种些树并指定了三个号码b,e ...

  9. BZOJ 1653 [Usaco2006 Feb]Backward Digit Sums ——搜索

    [题目分析] 劳逸结合好了. 杨辉三角+暴搜. [代码] #include <cstdio> #include <cstring> #include <cmath> ...

随机推荐

  1. PHP实用小程序(三)

    <HTML> <HEAD> <TITLE>给数组增加元素</TITLE> </HEAD> <? $Cities[] = "& ...

  2. Maven使用阿里云公共仓库

    https://help.aliyun.com/document_detail/102512.html?spm=a2c40.aliyun_maven_repo.0.0.3618305449xZaK

  3. HDU5112【水】

    #include <bits/stdc++.h> using namespace std; typedef long long LL; const int N=1e4+10; struct ...

  4. Unity亚洲开发者大会会议简录之技术篇,Profiler的一些参数的意思

    2014Unity亚洲开发者大会会议简录之技术篇 拖公司的福,有幸去了一趟北京参加了一场Unity3D的交流盛宴,在为期两天的时间内,不仅有着技术上收获,也有心灵上的震撼.现在先来说说技术方面的一些比 ...

  5. 码云最火爆开源项目 TOP 50,你都用过哪些?

    前 20 名预览 排名软件排名软件 1zheng11AOSuite 2JFinal12Spiderman 3t-io13AG-Admin 4guns14renren-security 5hutool1 ...

  6. html 5 video audio

    autoplay autoplay 如果出现该属性,则视频在就绪后马上播放. controls controls 如果出现该属性,则向用户显示控件,比如播放按钮. height pixels 设置视频 ...

  7. javascript高级程序设计学习笔记

    javascript高级程序设计,当枕头书已经好久了~zz  现在觉得自己在js的开发上遇到了一些瓶颈,归根究底还是基础太薄弱,所以重新刷一遍js高程希望有更新的认识. 一.javascript简介 ...

  8. bryce1010专题训练——LCA

    1.Targan算法(离线) http://poj.org/problem?id=1470 /*伪代码 Tarjan(u)//marge和find为并查集合并函数和查找函数 { for each(u, ...

  9. 修复在unix系统里的文件打开不能显示正常的颜色问题

    在mac上面看到mysql的配置文件的颜色永远是白色,为了让配置文件的颜色更加分明些,这个时候只需进入到home目录下新建一个.vimrc文件, vim  .vimrc set nu syntax o ...

  10. struts2的@Result annotation 如何添加params,并且在页面取值

    http://www.bubuko.com/infodetail-2492575.html .............................................. 标签:lai  ...