Advertisement
Josif_tepe

Untitled

Mar 24th, 2024
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, c, d, e;
  7.     int tabaci, strana;
  8.     cin >> tabaci >> strana;
  9.    
  10.     int S = 1;
  11.     int E = tabaci * 4;
  12.    
  13.     for(int i = 0; i < tabaci; i++) {
  14.        
  15.        
  16.         if(strana == S) {
  17.             cout << S + 1 << " " << E - 1 << " " << E << endl;
  18.         }
  19.         else if(strana == S + 1) {
  20.             cout << S << " " << E - 1 << " " << E << endl;
  21.         }
  22.         else if(strana == E - 1) {
  23.             cout << S << " " << S + 1 << " " << E << endl;
  24.         }
  25.         else if(strana == E) {
  26.             cout << S << " " << S + 1 << " " << E - 1 << endl;
  27.         }
  28.         S += 2;
  29.         E -= 2;
  30.     }
  31.    
  32.    
  33.     return 0;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement