Advertisement
yeskendir_sultanov

(C) Чет и нечет

Apr 25th, 2024
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.16 KB | Source Code | 0 0
  1. n, k = map(int, input().split())
  2.  
  3. oddCount = (n + 1) // 2
  4. evenCount = n // 2
  5.  
  6. if k <= oddCount:
  7.     print(k * 2 - 1)
  8. else:
  9.     k -= oddCount
  10.     print(k * 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement