A8910 | Cows and Poker Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
There are $n$ cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may show his/her hand to the table. However, so as not to affect any betting decisions, he/she may only do so if all other players have a status of either "ALLIN" or "FOLDED". The player's own status may be either "ALLIN" or "IN".
Find the number of cows that can currently show their hands without affecting any betting decisions.
Find the number of cows that can currently show their hands without affecting any betting decisions.
输入格式
The first line contains a single integer, $n$ ( $2<=n<=2·10^{5}$ ). The second line contains $n$ characters, each either "A", "I", or "F". The $i$ -th character is "A" if the $i$ -th player's status is "ALLIN", "I" if the $i$ -th player's status is "IN", or "F" if the $i$ -th player's status is "FOLDED".
输出格式
The first line should contain a single integer denoting the number of players that can currently show their hands.
输入输出样例
输入 #1
6 AFFAAA
输出 #1
4
输入 #2
3 AFI
输出 #2
1
In the first sample, cows 1, 4, 5, and 6 can show their hands. In the second sample, only cow 3 can show her hand.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted