神马情况,怎么才40分
查看原帖
神马情况,怎么才40分
477258
charleshe楼主2021/12/10 19:22

闰土。

#include <iostream>
using namespace std;
struct student{
	bool p,q;
} stu[101];
int n,m,type,all,ans;
int main(){
	cin>>n>>m>>type;
	ans=n;
	for(int i=1;i<=n;i++){
		cin>>stu[i].p;
	}
	for(int i=1;i<=n;i++){
		cin>>stu[i].q;
	}
	for(int i=1;i<=n;i++){
		if(stu[i].p==1&&stu[i].q==1){
			all++;
		}
	}
	if(all>=m) ans-=all-1;
	cout<<ans;
	return 0;
}
2021/12/10 19:22
加载中...