fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int A[]={2,5};
  7. int B[]={3,8};
  8. int C[]={-5,8};
  9. int D[]={5,10};
  10. int E[]={-10,100};
  11. int n=sizeof(A)/sizeof(A[0]);
  12. int count=0;
  13. unordered_map<int,int>m;
  14. for(int i=0;i<n;i++){
  15. m[E[i]]++;
  16. }
  17. for(int i=0;i<n;i++){
  18. for(int j=0;j<n;j++){
  19. for(int k=0;k<n;k++){
  20. for(int l=0;l<n;l++){
  21. int x=-(A[i]+B[j]+C[k]+D[l]);
  22. int count=count+m[x];
  23. }
  24. }
  25. }
  26. }
  27. cout<<"The no of tuplets are:"<<count;
  28. return 0;
  29. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
The no of tuplets are:0