結果

問題 No.822 Bitwise AND
ユーザー ks2mks2m
提出日時 2019-04-26 23:28:01
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 442 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 71,940 KB
実行使用メモリ 56,508 KB
最終ジャッジ日時 2023-09-08 01:12:13
合計ジャッジ時間 5,201 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 120 ms
55,504 KB
testcase_02 AC 121 ms
55,936 KB
testcase_03 AC 123 ms
55,776 KB
testcase_04 AC 128 ms
56,084 KB
testcase_05 AC 122 ms
55,964 KB
testcase_06 AC 122 ms
55,740 KB
testcase_07 AC 126 ms
55,888 KB
testcase_08 AC 124 ms
55,880 KB
testcase_09 AC 124 ms
55,876 KB
testcase_10 AC 123 ms
56,160 KB
testcase_11 AC 123 ms
55,868 KB
testcase_12 AC 123 ms
56,464 KB
testcase_13 AC 122 ms
56,184 KB
testcase_14 AC 123 ms
55,452 KB
testcase_15 AC 119 ms
55,880 KB
testcase_16 AC 124 ms
56,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		if (n < k) {
			System.out.println("INF");
			return;
		}

		int ans = 0;
		for (int i = n; i <= n + k; i++) {
			for (int j = i; j <= i + k; j++) {
				if ((i & j) == n) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}
0