結果

問題 No.822 Bitwise AND
ユーザー tomatoma
提出日時 2019-04-26 21:45:44
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 486 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 165,012 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-08 01:07:49
合計ジャッジ時間 5,408 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 367 ms
4,380 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 486 ms
4,376 KB
testcase_05 AC 211 ms
4,380 KB
testcase_06 AC 351 ms
4,380 KB
testcase_07 AC 484 ms
4,380 KB
testcase_08 AC 104 ms
4,380 KB
testcase_09 AC 85 ms
4,376 KB
testcase_10 AC 94 ms
4,380 KB
testcase_11 AC 99 ms
4,376 KB
testcase_12 AC 102 ms
4,500 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 101 ms
4,380 KB
testcase_15 AC 264 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include"bits/stdc++.h"

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	ll N, K, res = 0, cnt = 0;
	cin >> N >> K;
	REP(x, N * 16 + 4e5)FOR(y, x, x + K + 1) {
		if ((x&y) == N) {
			//cerr << x << " " << y << endl;
			res++;
			if (x > N * 4 + 1e5)cnt++;
		}
	}
	cout << (cnt > 0 ? "INF" : to_string(res)) << endl;


	return 0;
}
0