传送门
首先长方形两条对角线一定是圆的直径。
然后对角线条数可以O(N)求。
答案就是C(对角线条数,2)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#define N 1000005
using namespace std;
int s[25],n,x,p;
inline int read(){
int k=0;
char ch=getchar();
for (;ch<'0'||ch>'9';ch=getchar());
for (;ch>='0'&&ch<='9';ch=getchar()) k=k*10+ch-48;
return k;
}
int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++){
scanf("%d",&x);
s[i]=s[i-1]+x;
}
if (s[n]%2){
printf("0");
return 0;
}
for (int i=1;i<=n;i++)
for (int j=i+1;j<=n;j++)
if (s[j]-s[i]==s[n]/2) p++;
printf("%d",p*(p-1)/2);
}