fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. long long k1, k2;
  8. cin >> n >> k1 >> k2;
  9.  
  10. vector<long long> arr(n);
  11. for(int i = 0; i < n; i++) cin >> arr[i];
  12.  
  13. long long total = 0;
  14.  
  15. for(int a = 0; a < n; a++) {
  16. for(int b = a + 1; b < n; b++) {
  17. if(arr[a] + arr[b] <= k1) continue;
  18. for(int c = 0; c < n; c++) {
  19. for(int d = c + 1; d < n; d++) {
  20. if(arr[c] + arr[d] > k2) {
  21. total++;
  22. }
  23. }
  24. }
  25. }
  26. }
  27.  
  28. cout << total << endl;
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0.01s 5316KB
stdin
5
1 2 3 4 5
5 6
stdout
100