結果

問題 No.2393 Bit Grid Connected Component
ユーザー ks2mks2m
提出日時 2023-07-28 22:40:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 74,520 KB
実行使用メモリ 60,464 KB
最終ジャッジ日時 2024-04-16 06:38:30
合計ジャッジ時間 5,918 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
37,172 KB
testcase_01 AC 52 ms
37,172 KB
testcase_02 AC 54 ms
37,220 KB
testcase_03 AC 54 ms
37,144 KB
testcase_04 AC 54 ms
37,116 KB
testcase_05 AC 54 ms
37,096 KB
testcase_06 AC 54 ms
37,148 KB
testcase_07 AC 54 ms
37,096 KB
testcase_08 AC 54 ms
36,488 KB
testcase_09 AC 54 ms
36,612 KB
testcase_10 WA -
testcase_11 AC 56 ms
36,972 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 160 ms
41,244 KB
testcase_15 AC 172 ms
41,988 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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((1 << m) - 1);
		}
		pw.flush();
		br.close();
	}
}
0