一个简单的模拟题,直接上满分源码吧
#include<bits/stdc++.h>
using namespace std;
int a[1005],b[1005];
int main()
{
int n,drop=0,all=0,e=0;
cin>>n;
for(int i=1; i<=n; ++i)
{
int t;
cin>>t;
for(int u=0; u<t; ++u)
{
int p;
cin>>p;
if(u==0)
a[i]=p;
else if(p>0&&a[i]!=p)
{
b[i]=1;
a[i]=p;
}
else if(p<=0)
a[i]+=p;
}
all+=a[i];
if(b[i])
drop++;
}
for(int i=1; i<=n-2; ++i)
if(b[i]&&b[i+1]&&b[i+2])
e++;
if(b[n-1]&&b[n]&&b[1])
e++;
if(b[n]&&b[1]&&b[2])
e++;
cout<<all<<" "<<drop<<" "<<e;
return 0;
}
/*
4
4 74 -7 -12 -5
5 73 -8 -6 59 -4
5 76 -5 -10 60 -2
5 80 -6 -15 59 0
*/