一道简单的模拟
。。。
include
include
using namespace std;
int main() {
const int N=1010;
bool drop[N]={false};
int n,m,i,j,cnt=0,cnt1=0;
cin>>n;
int y;
int sum=0,sum1,temp=0;
int index;
for(i=0;i<n;i++){
sum1=0;
scanf("%d",&m);
for(j=0;j<m;j++){
scanf("%d",&y);
if(y>0) {
if(sum1>y) drop[i]=true;
sum1=y;
}
else sum1+=y;}
sum+=sum1;
}
for(i=1;i<n-1;i++){
if(drop[i-1]&&drop[i]&&drop[i+1]) cnt++;
}
if(drop[n-1]&&drop[0]&&drop[1]) cnt++;
if(drop[n-2]&&drop[n-1]&&drop[0]) cnt++;
for(i=0;i<n;i++) {
if(drop[i]) cnt1++;
}
cout<<sum<<' '<<cnt1<<' '<<cnt;
return 0;
}