Advertisement
Josif_tepe

Untitled

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