fork download
  1. #include <iostream>
  2. using namespace std;
  3. using namespace std;
  4. #include<vector>
  5. int main() {
  6. // your code goes here
  7. vector<int>arr={18,5,4,3,2,1,8,10};
  8. int count=0;
  9. for(int i=0;i<arr.size();i++)
  10. {
  11. for(int j=i+1;j<arr.size();j++)
  12. {
  13. for(int k=j+1;k<arr.size();k++)
  14. {
  15. if(arr[i]<arr[j] && arr[j]<arr[k])
  16. count++;
  17. }
  18. }
  19. }
  20. if(count!=0)
  21. cout<<"true"<<endl<<count;
  22. else
  23. cout<<"false";
  24. return 0;
  25. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
true
5