题目地址: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 |
|
|
| 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 }