結果
| 問題 |
No.822 Bitwise AND
|
| コンテスト | |
| ユーザー |
rickytheta
|
| 提出日時 | 2019-04-26 22:44:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 2,000 ms |
| コード長 | 361 bytes |
| コンパイル時間 | 1,781 ms |
| コンパイル使用メモリ | 158,112 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 18:14:57 |
| 合計ジャッジ時間 | 2,292 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d%d",&n,&k);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<n; i++)
int n,k;
int main(){
scanf("%d%d",&n,&k);
if(n+1 <= k){
puts("INF");
return 0;
}
int ans = 0;
REP(x,200000)REP(i,k+1){
int y = x+i;
if((x&y) == n)ans++;
}
printf("%d\n",ans);
return 0;
}
rickytheta