Advertisement
TwITe

Untitled

Jan 15th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void test() {
  5.     vector<int> v;
  6.     for (int i = 1; i <= 10; i++) {
  7.         v.push_back(i);
  8.     }
  9.  
  10.     for (int i = 9; i != 5; i = v[i]) {
  11.         cout << v[i] << " " <<  i << " "; // 10 9 0 10 1 0 2 1 3 2 4 3 5 4
  12.         cout.flush();
  13.     }
  14.  
  15. }
  16.  
  17. int main() {
  18.     test();
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement