#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1010;
int cnt1[N];
bool st[N];
int t;
int main(){
memset(cnt1, 0, sizeof cnt1);
memset(st, 0, sizeof st);
int n;
scanf("%d", &n);
for (int i = 0; i < n; i ++){
int m;
scanf("%d", &m);
scanf("%d", &cnt1[i]);
for (int j = 1; j < m; j ++){
scanf("%d", &t);
if (t > 0){
if (t < cnt1[i]) st[i] = true;
cnt1[i] = t;
}
else{
cnt1[i] += t;
}
}
}
int ans1 = 0, ans2 = 0, ans3 = 0;
for (int i = 0; i < n; i ++)
ans1 += cnt1[i];
for (int i = 0; i < n; i ++)
if (st[i])
ans2 ++;
if(n >= 3)
for(int i = 0; i < n; i++)
if(st[(i - 1 + n) % n] && st[i] && st[(i + 1) % n]) ans3++;
//对于圆圈的问题,对总人数取余数是很有效的 , 负数先加
cout << ans1 << " " << ans2 << " " << ans3 << endl;
return 0;
}
CCF201909-2 小明种苹果(续)(100分)
最新推荐文章于 2021-04-08 16:07:13 发布