#include<cstdio>
//#include<algorithm>
//#include<cstring>
//#include<cmath>
//#include<iostream>
using namespace std;
//
struct tree{
int m;
int a[1010];//操作数 数组
int apples;//剩下的苹果
bool fall;//是否苹果掉落
}trees[1010];
int main()
{
int n;
int t=0;
int d=0;
int e=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
trees[i].fall=false;
scanf("%d",&trees[i].m);
for(int j=0;j<trees[i].m;j++){
scanf("%d",&trees[i].a[j]);
if(j==0) {
trees[i].apples=trees[i].a[0];
continue;
}
if(trees[i].a[j]<=0){
trees[i].apples-=-trees[i].a[j];
}
if(trees[i].a[j]>0&&trees[i].a[j]!=trees[i].apples) {
trees[i].fall=true;
trees[i].apples=trees[i].a[j];
}
}
t+=trees[i].apples;
if(trees[i].fall==true) d++;
}
if(trees[1].fall==true&&trees[0].fall==true&&trees[n-1].fall==true) e++;
if(trees[0].fall==true&&trees[n-1].fall==true&&trees[n-2].fall==true) e++;
for(int i=2;i<n;i++){
if(trees[i].fall==true&&trees[i-1].fall==true&&trees[i-2].fall==true) e++;
}
printf("%d %d %d",t,d,e);
return 0;
}
csp 20190902 小明种苹果(续)c++/c
最新推荐文章于 2021-04-10 19:55:43 发布