作者:
no_one
,
2022-09-23 09:02:45
,
所有人可见
,
阅读 51
过辣
但是有一个问题, 如果是考试,我可能发现不了错误,很离谱
我是提交了知道错了才改的, 如果是考试就没分了
哎~~~~~~~~~~~~
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1010;
bool yin[N];
int a[N];
int t;
int main()
{
cin >> t;
int cnt = 1;
int summ = 0, res = 0, ress = 0;
while (t -- )
{
int m;
cin >> m;
for(int i = 1; i <= m; i ++) cin >> a[i];
int ans = a[1];
int c = 0;
bool st = false;
for(int i = 1; i <= m; i ++)
{
if(a[i] <= 0) ans += a[i];
if(a[i] > 0 && ans > a[i])
{
ans = a[i];
if(!st)
{
res ++;
yin[cnt] = true;
st = true;
}
}
}
summ += ans;
cnt ++;
}
cnt --;
for(int i = 2; i <= cnt + 1; i ++)
{
int a = i - 1, b = i + 1, c = i;
if(a > cnt) a -= cnt;
if(b > cnt) b -= cnt;
if(c > cnt) c -= cnt;
if(yin[a] && yin[b] && yin[c]) ress ++;
}
cout << summ << ' ' << res << ' ' << ress;
return 0;
}