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. JSBridge框架解决通信问题实现移动端跨平台开发

    一.跨平台开发是趋势 目前主流的移动端平台主要是Android和iOS,为了尽可能复用代码和节省开发成本,各大巨头都开发了自己的跨平台框架,比如Facebook的React-Native.阿里的Wee ...

  2. Levenberg-Marquardt

    c++ opencv L-M源码 http://www.shenlejun.cn/article/show.asp?id=97 什么是最优化,可分为几大类? 答:Levenberg-Marquardt ...

  3. Splay(区间翻转) 模板

    洛谷:P3391 [模板]文艺平衡树(Splay) #include<cstdio> #include<iostream> #include<algorithm> ...

  4. ZOJ 4016 Mergeable Stack(from The 18th Zhejiang University Programming Contest Sponsored by TuSimple)

    模拟题,用链表来进行模拟 # include <stdio.h> # include <stdlib.h> typedef struct node { int num; str ...

  5. jsp内置对象分析

    1.html表单的提交方式比较: 1.1.get方式:将表单内容经过编码之后 ,通过URL发送, 使用get方式发送时有255个字符的限制. 1.2.post方式:将表单的内容通过http发送,pos ...

  6. python错误之RuntimeError: dictionary changed size during iteration

    pythonn报错信息: C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/Ad ...

  7. 学习中对input()的一些总结(raw_input()与input())

  8. 修改php默认的FastCGI模式为ISAPI模式的方法

    一.到www.php.net中下载PHP的ZIP文件包.注意版本要对应. 二.将sapi目录中的:php4isapi.dll复制到c:\php目录中. 三.进入虚拟主机管理平台的"网站管理& ...

  9. [转]Android应用自动更新功能的代码实现

    本文转自:http://www.cnblogs.com/coolszy/archive/2012/04/27/2474279.html 由于Android项目开源所致,市面上出现了N多安卓软件市场.为 ...

  10. winfrom项目的打印

    自己可以下一个PDF打印机(例如下载64位office虚拟打印文档) 首先要添加控件 1.添加打印的选项卡,并命名为打印 2.点击打印选项卡,右击鼠标,选择选择项 using System;using ...