zoukankan      html  css  js  c++  java
  • Hdu 1703 PBD

    PBD

    Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 1065    Accepted Submission(s): 402

    Problem Description

    PrisonBreak is a popular TV programme in HDU. ACboy likes it very much, and he join a PrisonBreak discussing team called "PBD".Every Tuesday night, a lot of PBDers will contact with each other to discuss the newest plot of PrisonBreak season2. Generally speaking, every PBDer has distinct ideas about the play, so everyone want to know all the others' ideas. For example, when ACboy contract with Sam, ACboy will tell all the ideas he konws to Sam, and Sam will also tell all the ideas he konws to ACboy, and the call costs 5 yuan.
    If there are N people in the "PBD" team, what is the minimum cost to let everyone knows all the others' ideas?

    Input

    The input contains multiple test cases.
    Each test case contains a number N, means there are N people in the "PBD" team.N = 0 ends the input.(A call cost 5 yuan).

    Output

    for each case, output a integer represent the minimum cost to let everyone knows all the others' ideas.

    Sample Input

    1

    2

    3

    4

    0

    Sample Output

    0

    5

    15

    20

    #include<stdio.h>int main()
    {
        int n;
        while(scanf("%d",&n)!=EOF&&n!=0)
        {
            if(n<=4)
            switch(n)
            {
                case 1:printf("0
    ");break;
                case 2:printf("5
    ");break;
                case 3:printf("15
    ");break;
                case 4:printf("20
    ");break;
            }
            else
            {
                printf("%d
    ",10*n-20);
            }
        }
        return 0;
    }
    

      

  • 相关阅读:
    洛谷 P1941 飞扬的小鸟
    洛谷P2464 [SDOJ2008]郁闷的小J
    [cogs2314][HZOI 2015] Persistable Editor
    [vijos1067]Warcraft III 守望者的烦恼
    【vijos1049】送给圣诞夜的礼品
    [cogs347]地震
    gcc 编译多个源文件
    2_兔子产仔问题
    1_鸡兔同笼问题
    LeetCode(61) Rotate List
  • 原文地址:https://www.cnblogs.com/zhangliu/p/7058024.html
Copyright © 2011-2022 走看看