fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main (){
  5. int k,n;
  6. cin >> n >>k;
  7. if( ceil((double)n/2) < k){
  8. cout << (k- ceil((double)n/2))* 2;
  9. }
  10. else cout << k*2 -1;
  11. return 0;
  12. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
4.13666e+09