fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. long long n, res = 0;
  5. cin >> n;
  6. long long a[n][4];
  7. for (int i = 0; i < n; i++) {
  8. cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
  9. }
  10.  
  11. for (int j = 0; j < n; j++) {
  12. for (int k = 0; k < n; k++) {
  13. for (int l = 0; l < n; l++) {
  14. for (int m = 0; m < n; m++) {
  15.  
  16. if (a[j][0] + a[k][1] + a[l][2] + a[m][3] == 0) {
  17. res++;
  18. }
  19. }
  20. }
  21. }
  22. }
  23.  
  24. cout << res;
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 3464KB
stdin
5
1 -1 0 1
2 8 -2 0
4 2 7 -10
9 -9 -11 11
4 2 4 0
stdout
28