結果
| 問題 |
No.822 Bitwise AND
|
| コンテスト | |
| ユーザー |
IKyopro
|
| 提出日時 | 2019-04-26 22:06:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 59,456 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 04:00:21 |
| 合計ジャッジ時間 | 1,147 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 2 |
ソースコード
#include <iostream>
#include <cmath>
#include <cassert>
using namespace std;
int N,K;
int main(){
cin >> N >> K;
int ma = -1;
for(int i=0;i<30;i++) if(N&(1<<i)) ma = i;
if(K>=(1<<(ma+1))){
cout << "INF" << endl;
return 0;
}
int a = ceil(log2(K));
int ans = 0;
for(int i=0;i<=N+(1<<(a+2));i++){
for(int j=0;j<=K;j++){
// cerr << (i & (i+j)) << endl;
if((i & (i+j))==N) ans++;
}
}
cout << ans << endl;
}
IKyopro