zoukankan      html  css  js  c++  java
  • 2012湖南大学第八届程序设计竞赛 Incredible[公式]

    题目地址:http://acm.hnu.cn/online/?action=problem&type=show&id=12312&courseid=215 

    Incredible
    Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:65536KB
    Total submit users: 9, Accepted users: 8
    Problem 12312 : No special judgement
    Problem description
    Zhuge Liang, a person?of?great?wisdom?and?resourcefulness, who is capable of knowing things 500 years ago and predicting things 500 years later. What's incredible! He must could make large amounts of money if he still alive today because he could forecast everything. Now, we want invite him to help us to forecast the result of football matches. The Olympic Games of this year will hold in London, England. Assume that the rule of football in Olympic Games is as same as group stage. That's to say, there are n teams in a group and k teams which have higher scores will be promoted. Each team will play a match against each other teams of that group. For a match, the winner team will get A scores and the loser will get zero scores. Both two teams will get A/2(real number) scores if the result is tie. At last, each team will have a score and we will choose the k-highest teams as promoted teams. Now, can you calculate the least score that can ensure one team for promotion?

    Input
    There are several test cases end with EOF. For each test case, the first line is three integers n ( 0 < n ≤ 50 ), k ( 0 < k ≤ n ) and A ( 0 < A < 10000 ), which are described as above.


    Output
    For each the case, just output a real number rounded to two decimal places which means the least score that one team can be promoted.


    Sample Input
    4 2 3
    3 1 2
    
    Sample Output
    7.50
    4.00
    
    Problem Source
    The 2012 8th Hunan University Programming Contest

    Submit   Discuss   Judge Status  Problems  Ranklist 

    解体报告:

             题目大意:  

                   给出N个球队,球队之间两两会进行一场比赛,赢的球队得A分,输的球队不得分,两个球队打平的话各得A/2分。现在在最开始一场球赛都没有打过的前提下,问球队需要至少多少分使得在任意情况下该球队都能排在前K名之内。

            

    code:

     1 #include<iostream>
     2 using namespace std;
     3 int main()
     4 {
     5     int n,k;
     6     double A;
     7     double score;
     8     while(~scanf("%d%d%lf",&n,&k,&A))
     9     {
    10         if(k==n)
    11             score=0;
    12         else
    13         {
    14             score=(n-1)*A;
    15             while(--k)
    16                 score-=(A/2.0);
    17         }        
    18         printf("%.2f\n",score);
    19     }
    20     return 0; 
    21 }






                If you have any questions about this article, welcome to leave a message on the message board.



    Brad(Bowen) Xu
    E-Mail : maxxbw1992@gmail.com


  • 相关阅读:
    Atitit 图像金字塔原理与概率 attilax的理解总结qb23
    Atiti  attilax主要成果与解决方案与案例rsm版 v4
    Atitit 常用比较复杂的图像滤镜 attilax大总结
    Atitit. Api 设计 原则 ---归一化
    Atitit 面向对象弊端与问题 坏处 缺点
    Atitit  记录方法调用参数上下文arguments
    Atitit 作用域的理解attilax总结
    Atitit usrQBM1603短信验证码规范
    atitit 短信验证码的源码实现  .docx
    Atitit 图片 验证码生成attilax总结
  • 原文地址:https://www.cnblogs.com/XBWer/p/2600490.html
Copyright © 2011-2022 走看看