其他分享
首页 > 其他分享> > ccf201909-1小明种苹果

ccf201909-1小明种苹果

作者:互联网

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n,m;
	int sum=0,number=0;
	int a[1005],b[1005]={0};
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
		for(int j=0;j<m;j++)
		{
			cin>>number;
			b[i]+=number;
		}
		sum+=b[i];
		if(b[i]<0) b[i] = -b[i];
	}
	int max=0;
	for(int i=1;i<n;i++)
	{
		if(b[i]>b[max]) max=i;
	}
	cout<<sum<<" "<<max+1<<" "<<b[max]<<endl;
	return 0;
}
/*
3 3
73 -8 -6 -4
76 -5 -10 -8
80 -6 -15 0

2 2
10 -3 -1
15 -4 0
*/

 

标签:小明种,int,max,sum,number,苹果,ccf201909,1005,include
来源: https://blog.csdn.net/swing123lovecoding/article/details/112492995