zoukankan      html  css  js  c++  java
  • 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);
        }
    }
    

      

     
  • 相关阅读:
    pip 8 安装
    zabbix server配置文件
    双代号网络图、双代号时标网络图
    logrotate
    tsql 执行存储过程
    dos 加用户
    Visual Studio (VS IDE) 你必须知道的功能和技巧
    格式化数字字符串 与C#变量
    .NET中的字符串你了解多少?
    新手如何有效地学习.NET
  • 原文地址:https://www.cnblogs.com/mjn1/p/8435754.html
Copyright © 2011-2022 走看看