結果
問題 | No.822 Bitwise AND |
ユーザー |
|
提出日時 | 2019-04-26 21:36:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 763 ms / 2,000 ms |
コード長 | 465 bytes |
コンパイル時間 | 643 ms |
コンパイル使用メモリ | 70,480 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 18:11:43 |
合計ジャッジ時間 | 10,266 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include <iostream>#include <algorithm>#include <vector>using namespace std;int f(int N, int K, int L) {int ans = 0;for (int i = 0; i <= L; i++) {for (int j = i; j <= i+K; j++) {if ((i & j) == N) {ans++;}}}return ans;}int main() {int N, K;cin >> N >> K;int ans = f(N, K, 1000000);int ans2 = f(N, K, 2000000);if (ans != ans2) {cout << "INF" << endl;} else {cout << ans << endl;}}