1 条题解

  • 1
    @ 2024-11-12 19:56:36
    /**
     *    author: 小飞侠
     *    created: 2024.11.11 23:12:26
     */
    #include <bits/stdc++.h>
    #define ls u << 1
    #define rs u << 1 | 1
    #define LL long long
    #define int long long
    #define PII pair <int, int>
    #define fi first
    #define se second
    #define pub push_back
    #define pob pop_back
    #define puf push_front
    #define pof pop_front
    #define lb lower_bound
    #define ub upper_bound
    #define i128 __int128
    #define pcnt(x) __builtin_popcount(x)
    #define mem(a,goal) memset(a, (goal), sizeof(a))
    #define rep(x,start,end) for(int x = (start) - ((start) > (end)); x != (end) - ((start) > (end)); ((start) < (end) ? x ++ : x --))
    #define aLL(x) (x).begin(), (x).end()
    #define sz(x) (int)(x).size()
    const int INF = 998244353;
    const int P = 1e9 + 7;
    const int N = 2e5 + 5;
    void solve()
    {
        int n;
        std:: cin >> n;
        std:: vector<int> a(n + 1), s(n + 1);
        for(int i = 1; i <= n; ++ i)
        {
            std:: cin >> a[i];
            s[i] = s[i - 1] + a[i];
        }
        int ans = 0;
        int maxx = -1e9 - 10;
        for(int i = 1; i <= n; ++ i)
        {
            maxx = std:: max(maxx, a[i]);
            if(s[i] - maxx == maxx) ans ++;
        }
        std :: cout << ans << '\n';
    }
    signed main()
    {
        int t;
        std:: cin >> t;
        while(t --) solve();
        return 0;
    }
    
    • 1

    信息

    ID
    5473
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    10
    已通过
    3
    上传者