結果

問題 No.822 Bitwise AND
ユーザー tailstails
提出日時 2021-01-05 20:43:13
言語 C
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 421 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 31,616 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-08 01:18:23
合計ジャッジ時間 1,341 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:7:13: 警告: 関数 ‘scanf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    7 |   int n, k; scanf("%d%d", &n, &k);
      |             ^~~~~
main.c:1:1: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | // original: https://yukicoder.me/submissions/345669
main.c:7:13: 警告: 組み込み関数 ‘scanf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
    7 |   int n, k; scanf("%d%d", &n, &k);
      |             ^~~~~
main.c:7:13: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:8:18: 警告: 関数 ‘puts’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    8 |   if(k >= n + 1) puts("INF");
      |                  ^~~~
main.c:8:18: 備考: include ‘<stdio.h>’ or provide a declaration of ‘puts’
main.c:18:5: 警告: 関数 ‘printf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   18 |     printf("%d\n", res);
      |     ^~~~~~
main.c:18:5: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:18:5: 警告: 組み込み関数 ‘printf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
main.c:18:5: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

// original: https://yukicoder.me/submissions/345669

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

int main(void){
  int n, k; scanf("%d%d", &n, &k);
  if(k >= n + 1) puts("INF");
  else{
    int res = 0;
    for(int x = n; x <= n + k; ++x){
      if((n & x) == n){
        for(int y = x; y <= x + k; ++y){
          if((x & y) == n) ++res;
        }
      }
    }
    printf("%d\n", res);
  }
  return 0;
}
0