Saleh127

Untitled

Apr 16th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long a,b,c,d,e,f,i,j,k,l;
  6. cin>>a>>b;
  7. if(a==1)
  8. {
  9. cout<<1<<endl;
  10. }
  11. else if(a/2==b)
  12. {
  13. cout<<a/2+1<<endl;
  14. }
  15. else if(a==b)
  16. {
  17. cout<<a-1<<endl;
  18. }
  19. else if(a/2>b)
  20. {
  21. cout<<b+1<<endl;
  22. }
  23. else if(a/2<b)
  24. {
  25. cout<<b-1<<endl;
  26. }
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment