ccf201909-1小明种苹果

ccf201909-1小明种苹果

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
*/

 

上一篇:pta乙级1005 继续(3n+1)猜想 java


下一篇:LeetCode 165. Compare Version Numbers