A1086 | [COCI-2006_2007-contest5]#5 TENIS
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
After Borko's second plan of taking over the village fell through (because Mirko's brother Stanko drank all the water), young Zvonko decided to relax with sports. For this purpose he stocked up on carrot juice and peanuts, and dived onto the couch, ready to watch the next tennis match on television.
While the two players are warming up, their statistics pop up on the screen. Zvonko noticed that the match history of the players contained invalid results. He had a brilliant idea where you write him a program that checks the validity of results, which he will then sell to the record keepers and enjoy a leisurely life.
A tennis match consists of sets, each set consisting of games. The following rules apply:
• A player wins a set if he has 6 or more games and at least two games more than his opponent.
• Additionally, if the result is 6:6 in the first or second set (but not the third set), a single final game is played to determine the winner of the set (the tie-break game).
• The match ends when either player has won 2 sets. That player is the winner.
A match result is valid if a match could have been played by the above rules and ended in the result.
Additionally, if one of the players is Roger Federer (designated as "federer" in the input), then a result in which he has lost a set can't be valid (Zvonko knows Federer is from outer space).
Write a program that checks the validity of all matches between two players.
While the two players are warming up, their statistics pop up on the screen. Zvonko noticed that the match history of the players contained invalid results. He had a brilliant idea where you write him a program that checks the validity of results, which he will then sell to the record keepers and enjoy a leisurely life.
A tennis match consists of sets, each set consisting of games. The following rules apply:
• A player wins a set if he has 6 or more games and at least two games more than his opponent.
• Additionally, if the result is 6:6 in the first or second set (but not the third set), a single final game is played to determine the winner of the set (the tie-break game).
• The match ends when either player has won 2 sets. That player is the winner.
A match result is valid if a match could have been played by the above rules and ended in the result.
Additionally, if one of the players is Roger Federer (designated as "federer" in the input), then a result in which he has lost a set can't be valid (Zvonko knows Federer is from outer space).
Write a program that checks the validity of all matches between two players.
输入格式
The first line of input contains the names of the two players separated by a single space. Both names will be strings of at most 20 lowercase letters of the English alphabet. The names will be different.
The second line contains an integer N (1 ≤ N ≤ 50), how many matches the two players have played.
Each of the following N lines contains the result of a single match, composed of the results of a number of sets separated by single spaces. Each match result will contain between 1 and 5 sets.
A set is given in the format "A:B", where A and B are games won by each player. These numbers will be integers between 0 and 99 (inclusive).
The second line contains an integer N (1 ≤ N ≤ 50), how many matches the two players have played.
Each of the following N lines contains the result of a single match, composed of the results of a number of sets separated by single spaces. Each match result will contain between 1 and 5 sets.
A set is given in the format "A:B", where A and B are games won by each player. These numbers will be integers between 0 and 99 (inclusive).
输出格式
For each match, in the order they're given in the input, output "da" if the result is valid, or "ne" if it isn't.
输入输出样例
输入 #1
sampras agassi 6 6:2 6:4 3:6 7:5 2:6 6:5 7:4 7:6 7:6 6:2 3:6 6:2 1:6 6:8
输出 #1
federer roddick 1 2:6 4:6
输入 #2
da da ne da ne da
输出 #2
ne
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted