You are viewing a single comment's thread. Return to all comments →
Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0; i < t; i++) { int max = 0; int n = in.nextInt(); int k = in.nextInt(); std::cout << ((((k - 1) | k) > n && k % 2 == 0) ? k - 2 : k - 1) << std::endl; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 29: Bitwise AND
You are viewing a single comment's thread. Return to all comments →
Or replace your code with this: