結果

問題 No.822 Bitwise AND
ユーザー yoshnaryyoshnary
提出日時 2019-04-26 22:25:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 94,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 23:32:00
合計ジャッジ時間 8,952 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 692 ms
5,248 KB
testcase_01 AC 17 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 699 ms
5,376 KB
testcase_05 AC 335 ms
5,376 KB
testcase_06 AC 616 ms
5,376 KB
testcase_07 AC 703 ms
5,376 KB
testcase_08 AC 699 ms
5,376 KB
testcase_09 AC 596 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 684 ms
5,376 KB
testcase_13 AC 7 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 403 ms
5,376 KB
testcase_16 AC 10 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;

int main() {
	int n, k; cin >> n >> k;
	if (n == 0) {
		if (k == 0) cout << 1 << endl;
		else cout << "INF" << endl;
		return 0;
	}
	ll ans = 0;
	for (int x = 0; x < 3000000; x++) {
		for (int y = max(0, x - k); y <= x; y++) {
			if ((x&y) == n) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}
0