球球各位,为什么j的结果是8啊,不应该啊555
查看原帖
球球各位,为什么j的结果是8啊,不应该啊555
711598
lgchh楼主2022/4/7 13:24
#include<iostream>
using namespace std;
int main ()
{
	int u[7],v[7],a[7],i,max,imax,j;/*u[7],v[7]都是小于10的非负整数*/
	for(i=0;i<7;i++)
		cin>>u[i]>>v[i];
	for(i=0;i<7;i++)
	{
		if(u[i]+v[i]>8)
			a[i]=u[i]+v[i]-8;
		else a[i]=0;
	}
	for(max=0,imax=0,j=1;j<7;j++)
	{
		if(a[j]>max) 
		{
			imax=j;
			max=a[j];
		}
	}
	if(max!=0) cout<<j+1<<endl;
	else cout<<"0"<<endl;
	system("pause");
	return 0;
}
``
2022/4/7 13:24
加载中...