lina_os

Untitled

Dec 4th, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <algorithm>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  10.  
  11. unsigned long long n, k;
  12. cin >> n >> k;
  13. if (n>=k) {
  14. cout << k-1;
  15. return 0;
  16. }
  17. else cout <<2*n-k+1;
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment