c++全RE,不知到哪里错了
查看原帖
c++全RE,不知到哪里错了
759152
yinbe楼主2023/1/18 13:39
#include<iostream>
using namespace std;
int a[1005],type,cnt_1,cnt_0,n,m,cnt_true;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			scanf("%d",type);
			if(type==1)
			{
				cnt_1++;
			}
			else
			{
				cnt_0++;
			}
		}
		if(cnt_1>cnt_0)
		{
			a[i]=1;
		}
		else
		{
			a[i]=0;
		}
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%d",type);
		if(a[i]==type)
		{
			cnt_true++;
		}
	}
	printf("%d",cnt_true); 
	return 0;
}
2023/1/18 13:39
加载中...