#10587. 珅泽教育CSP-J第一轮模拟考第十三套 第 40 题
珅泽教育CSP-J第一轮模拟考第十三套 第 40 题
第1题
两人进行 次石头剪刀布游戏,给定对方的出拳序列,由 、、 组成(分别表示石头、剪刀、布)。你的出拳需满足:
- 从未输过(每次非赢即平)。
- 相邻两次出拳不同。
求可能赢的最大对局数(即赢的次数,平局不计入)。
#include<iostream>
int score(int a,int b){
if(____(1)____) return 0;
else if(a=='R' and b=='S')return 1;
else if(____(2)____)return 1;
else if(a=='P' and b=='R')return 1;
else return -10000000;
}
int main(){
____(3)____
int n;
std::cin>>n;
while(n-->0){
char c;
std::cin>>c;
int newR = ____(4)____;
int newS = ____(5)____;
int newP = ____(6)____;
R=newR;
S=newS;
P=newP;
}
std::cout<< ____(7)____;
}
(7)处应填( )。
{{ select(1) }}
std::min(std::min(R,S),P)std::max(std::max(R,S),P)n - std::min(std::min(R,S),P)n - std::max(std::max(R,S),P)