A9704 | Tennis Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores $t$ points, he wins the set; then the next set starts and scores of both players are being set to 0. As soon as one of the players wins the total of $s$ sets, he wins the match and the match is over. Here $s$ and $t$ are some positive integer numbers.
To spice it up, Petya and Gena choose new numbers $s$ and $t$ before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores $t$ points and the match is over as soon as one of the players wins $s$ sets.
Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numbers $s$ and $t$ for the given match are also lost. The players now wonder what values of $s$ and $t$ might be. Can you determine all the possible options?
To spice it up, Petya and Gena choose new numbers $s$ and $t$ before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores $t$ points and the match is over as soon as one of the players wins $s$ sets.
Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numbers $s$ and $t$ for the given match are also lost. The players now wonder what values of $s$ and $t$ might be. Can you determine all the possible options?
输入格式
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores $t$ points, he wins the set; then the next set starts and scores of both players are being set to 0. As soon as one of the players wins the total of $s$ sets, he wins the match and the match is over. Here $s$ and $t$ are some positive integer numbers.
To spice it up, Petya and Gena choose new numbers $s$ and $t$ before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores $t$ points and the match is over as soon as one of the players wins $s$ sets.
Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numbers $s$ and $t$ for the given match are also lost. The players now wonder what values of $s$ and $t$ might be. Can you determine all the possible options?
To spice it up, Petya and Gena choose new numbers $s$ and $t$ before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores $t$ points and the match is over as soon as one of the players wins $s$ sets.
Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numbers $s$ and $t$ for the given match are also lost. The players now wonder what values of $s$ and $t$ might be. Can you determine all the possible options?
输出格式
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores $t$ points, he wins the set; then the next set starts and scores of both players are being set to 0. As soon as one of the players wins the total of $s$ sets, he wins the match and the match is over. Here $s$ and $t$ are some positive integer numbers.
To spice it up, Petya and Gena choose new numbers $s$ and $t$ before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores $t$ points and the match is over as soon as one of the players wins $s$ sets.
Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numbers $s$ and $t$ for the given match are also lost. The players now wonder what values of $s$ and $t$ might be. Can you determine all the possible options?
To spice it up, Petya and Gena choose new numbers $s$ and $t$ before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores $t$ points and the match is over as soon as one of the players wins $s$ sets.
Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numbers $s$ and $t$ for the given match are also lost. The players now wonder what values of $s$ and $t$ might be. Can you determine all the possible options?
输入输出样例
输入 #1
5 1 2 1 2 1
输出 #1
2 1 3 3 1
输入 #2
4 1 1 1 1
输出 #2
3 1 4 2 2 4 1
输入 #3
4 1 2 1 2
输出 #3
0
输入 #4
8 2 1 2 1 1 1 1 1
输出 #4
3 1 6 2 3 6 1
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted