結果

問題 No.822 Bitwise AND
ユーザー tomatoma
提出日時 2019-04-26 21:45:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 701 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 1,546 ms
コンパイル使用メモリ 168,164 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 18:12:07
合計ジャッジ時間 6,637 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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