Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. while(1) {
  2.         if(voc[0] == n + 1) break;
  3.         print();
  4.         for(int i = m-1;i>0;i--){
  5.             while(voc[i] < voc[i-1] - 1){
  6.                 voc[i]++;
  7.                 if(i != m - 1){ voc[m - 1] = 1;
  8.                     for(int j = m-2;j>i;j--)
  9.                         voc[j] = voc[j+1]+1;
  10.  
  11.                 }
  12.                 i = m -1;
  13.  
  14.                 print();
  15.             }
  16.         }
  17.  
  18.         voc[0]++;
  19.         voc[m-1] = 1;
  20.         for(int i=m-2;i>0;i--)
  21.             voc[i] = voc[i+1] + 1;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement