fork download
  1. #include <iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. vector<int> a={1,3,4,5,2,7,8};
  8. vector<int> f;
  9. int k=-7;
  10. for(int i=0;i<a.size();i++) {
  11. for(int j=i+1;j<a.size();j++) {
  12. if(a[i]-a[j]==k) {
  13. cout<<a[i]<<a[j]<<endl;
  14. }
  15. }
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
18