社区讨论
我这怎么只有50分
P7184 [CRCI2008-2009] MAJSTOR参与者 3已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @lo169ncy
- 此快照首次捕获于
- 2023/10/22 15:53 2 年前
- 此快照最后确认于
- 2023/11/02 15:28 2 年前
CPP
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=101;
int check(char a,char b){
if(a==b)return 1;
else if(a=='R'&&b=='S'|| a=='P'&b=='R'||a=='S'&&b=='P')return 2;
return 0;
}
int r ,n,ans1,ans2;
string sven,friends[N];
int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin>>r>>sven>>n;
for(int i=1;i<=n;i++)cin>>friends[i];
for(int i=0;i<r;i++){
int max1=0,max2=0,max3=0;
for(int j=1;j<=n;j++){
ans1+=check(sven[i],friends[j][i]);
max1+=check('R',friends[j][i]);
max2+=check('S',friends[j][i]);
max3+=check('P',friends[j][i]);
}
ans2+=max(max1,max(max2,max3));
}cout<<ans1<<endl<<ans2;
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...