标签:
N<= 20
暴力枚举四个点对边距离是否相等
1 #include <bits/stdc++.h> 2 using namespace std; 3 int a[25][25]; 4 int main() 5 { 6 int n, ans = 0; 7 cin >> n; 8 for(int i = 1; i <= n; i++) 9 cin >> a[i][i + 1]; 10 a[n][1] = a[n][n + 1]; 11 for(int i = 1; i <= n; i++) 12 for(int j = i + 2; j != i; j = j % n + 1) 13 { 14 if(j > n) j -= n; 15 if(j == 1) a[i][j] = a[i][n] + a[n][1]; 16 else a[i][j] = a[i][j - 1] + a[j - 1][j]; 17 } 18 for(int i = 1; i <= n; i++) 19 for(int j = i + 1; j <= n; j++) 20 for(int k = j + 1; k <= n; k++) 21 for(int l = k + 1; l <= n; l++) 22 if(a[i][j] == a[k][l] && a[j][k] == a[l][i]) 23 ans++; 24 cout << ans << endl; 25 return 0; 26 }
标签:
原文地址:http://www.cnblogs.com/CtrlCV/p/5407856.html