Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void test() {
- vector<int> v;
- for (int i = 1; i <= 10; i++) {
- v.push_back(i);
- }
- for (int i = 9; i != 1; i = v[i]) {
- cout << v[i] << " " << i << " "; // 10 9 0 10 1 0 2 1 3 2 4 3 5 4
- cout.flush();
- }
- }
- int main() {
- test();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement