Advertisement
TwITe

Untitled

Oct 27th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1.  
  2.     for (int i = 1; i <= n; i++) {
  3.         flag = true;
  4.         int num = 1;
  5.         int start = i;
  6.         int next = a[i];
  7.         while (next != start) {
  8.             next = a[next];
  9.             start = next;
  10.             next = a[start];
  11.             next = a[next];
  12.             num++;
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement