【郑轻邀请赛 C】DOBRI

【题目链接】:https://acm.zzuli.edu.cn/zzuliacm/problem.php?id=2129

【题意】

【题解】

NMB
直接说i-1,i-2,i-3不就好了…

【Number Of WA

0

【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define ps push_back
#define fi first
#define se second
#define rei(x) cin >> x
#define pri(x) cout << x
#define ms(x,y) memset(x,y,sizeof x)

typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 1e5+100;

int n;
LL sum[N];

int main()
{
    //freopen("F:\\rush.txt","r",stdin);
    ios::sync_with_stdio(false);
    int T;
    cin >> T;
    while (T--)
    {
        cin >> n;
        sum[0] = 0;
        rep1(i,1,n)
        {
            LL x;
            cin >> x;
            sum[i] = sum[i-1]+x;
        }
        LL ans = 0;
        rep1(i,4,n)
            if (sum[i]==sum[i-1]+sum[i-2]+sum[i-3])
                ans++;
        cout << ans << endl;
    }
    //printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
    return 0;
}
posted @ 2017-10-04 18:44  AWCXV  阅读(167)  评论(0编辑  收藏  举报