​linkkkk​​​ 题意:
求满足CF1398C. Good Subarrays(思维 前缀和)_i++的子区间个数。
思路:
开始写了个降智代码;
实际上令CF1398C. Good Subarrays(思维 前缀和)_算法_02,那么式子就变成了CF1398C. Good Subarrays(思维 前缀和)_#include_03
经 典 题
记录一下这个小思维
代码:

// Problem: C. Good Subarrays
// Contest: Codeforces - Educational Codeforces Round 93 (Rated for Div. 2)
// URL: https://codeforces.com/problemset/problem/1398/C
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn=1e5+100;

int n,a[maxn];
map<ll,ll>mp;

int main(){
int _;cin>>_;
while(_--){
cin>>n;
for(int i=1;i<=n;i++) scanf("%1d",&a[i]),a[i]--;
ll ans=0,sum=0;
mp.clear();
mp[0]=1;
for(int i=1;i<=n;i++){
sum+=a[i];
ans=ans+mp[sum];
mp[sum]++;
}
cout<<ans<<endl;
}
return 0;
}