暴力。。
#include<cstdio> int n,cir[25],sum[25],ans=0; int main(){ freopen("1800.in","r",stdin); freopen("1800.out","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++){scanf("%d",&cir[i]);sum[i]=cir[i]+sum[i-1];} for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ for(int k=j+1;k<=n;k++){ for(int l=k+1;l<=n;l++){ if(sum[j-1]-sum[i-1]==sum[l-1]-sum[k-1] && sum[k-1]-sum[j-1]==sum[n]-sum[l-1]+sum[i-1])ans++; } } } } printf("%d\n",ans); return 0; }