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