zoukankan      html  css  js  c++  java
  • 【郑轻邀请赛 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("
    %.2lf sec 
    ", (double)clock() / CLOCKS_PER_SEC);
        return 0;
    }
    
  • 相关阅读:
    多表查询 left join
    对JS关于对象创建的几种方式的整理
    常见正则表达式
    spring
    富文本编辑器
    Struts2快速入门
    一个MySql Sql 优化技巧分享
    maven
    day3
    Spring MVC
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626424.html
Copyright © 2011-2022 走看看