201909-1-小明种苹果
作者:互联网
由于比较简单,这里直接贴代码
#include <bits/stdc++.h>
using namespace std;
struct node1
{
int sum;//苹果总数
int drop[1010];//记录每轮掉落
int drop_sum;//掉落总数
} apple[1010];
int N, M, i, j, T = 0, k, P = 0;
int main()
{
scanf("%d %d", &N, &M);
for(i=1; i<=N; i++)
{
scanf("%d", &apple[i].sum);
apple[i].drop_sum = 0;
for(j=1; j<=M; j++)
{
scanf("%d", &apple[i].drop[j]);
apple[i].drop_sum += apple[i].drop[j];
}
apple[i].drop_sum = abs(apple[i].drop_sum);
if(apple[i].drop_sum > P)
{
P = apple[i].drop_sum;
k = i;
}
T += (apple[i].sum - apple[i].drop_sum);
}
printf("%d %d %d", T, k, P);
return 0;
}
标签:apple,小明种,int,sum,drop,苹果,1010,scanf,201909 来源: https://blog.csdn.net/cloudy_sqyin/article/details/119323422