REPORT HDU5873-Football Games
Football Games
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 466 Accepted Submission(s): 171
Problem Description
A mysterious country will hold a football world championships—Abnormal Cup, attracting football teams and fans from all around the world. This country is so mysterious that none of the information of the games will be open to the public till the end of all the matches. And finally only the score of each team will be announced.
At the first phase of the championships, teams are divided into M groups using the single round robin rule where one and only one game will be played between each pair of teams within each group. The winner of a game scores 2 points, the loser scores 0, when the game is tied both score 1 point. The schedule of these games are unknown, only the scores of each team in each group are available.
When those games finished, some insider revealed that there were some false scores in some groups. This has aroused great concern among the pubic, so the the Association of Credit Management (ACM) asks you to judge which groups’ scores must be false.
Multiple test cases, process till end of the input.
//=======================================================
这题……
WA了三次因为没看到输入的第一句话。
这题……怎么说呢
所有球队总分等于m*(m-1),然后因为最多只有一个0分,一个队的最大得分是m*2-2,奇数分队伍是偶数支。
我最开始还在想是不是要枚举……
MDZZ
//=======================================================
#include <iostream> using namespace std; int main() { int T; while (cin >> T) { while (T--) { int m, s, tots = 0, s1 = 0, s0 = 0; bool flag = false; cin >> m; for (int i = 0; i < m; i++) { cin >> s; if (s % 2 == 1) s1++; tots += s; if (s == 0) s0++; if (s > 2 * m - 2) { flag = true; } } if ((m*(m - 1) == tots) && (s1 % 2 == 0) && (s0 <= 1) && !flag) cout << "T" << endl; else cout << "F" << endl; } } return 0; }