結果

問題 No.2393 Bit Grid Connected Component
ユーザー ks2mks2m
提出日時 2023-07-28 22:41:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 474 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 2,428 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 48,572 KB
最終ジャッジ日時 2024-04-16 06:39:22
合計ジャッジ時間 6,185 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
37,364 KB
testcase_01 AC 57 ms
36,992 KB
testcase_02 AC 56 ms
37,340 KB
testcase_03 AC 57 ms
37,156 KB
testcase_04 AC 58 ms
37,216 KB
testcase_05 AC 56 ms
37,284 KB
testcase_06 AC 58 ms
37,244 KB
testcase_07 AC 56 ms
37,224 KB
testcase_08 AC 58 ms
37,392 KB
testcase_09 AC 58 ms
36,964 KB
testcase_10 AC 57 ms
37,340 KB
testcase_11 AC 57 ms
37,220 KB
testcase_12 AC 59 ms
37,140 KB
testcase_13 AC 60 ms
37,408 KB
testcase_14 AC 168 ms
41,472 KB
testcase_15 AC 177 ms
42,128 KB
testcase_16 AC 281 ms
48,572 KB
testcase_17 AC 460 ms
46,112 KB
testcase_18 AC 443 ms
46,368 KB
testcase_19 AC 474 ms
46,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			String[] sa = br.readLine().split(" ");
			long x = Long.parseLong(sa[0]);
			int y = Integer.parseInt(sa[1]);
			int m = 0;
			for (int i = y + 1; i <= 60; i++) {
				if ((x >> i & 1) == 0) {
					m = i;
					break;
				}
			}
			pw.println((1L << m) - 1);
		}
		pw.flush();
		br.close();
	}
}
0