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);
        }
    }
    

      

     
  • 相关阅读:
    JSP指令用来设置整个JSP页面相关的属性
    JSP 生命周期 理解JSP底层功能的关键就是去理解它们所遵守的生命周期
    JSP 开发环境搭建
    JSP(Java Server Pages,即:Java服务器页面
    JSP 国际化
    JSP 调试
    JSP 异常处理
    JSP 自定义标签
    JSP JavaBean
    JSP 标准标签库(JSTL)
  • 原文地址:https://www.cnblogs.com/mjn1/p/8435754.html
Copyright © 2011-2022 走看看