結果

問題 No.353 ヘイトプラス
ユーザー NEEHATOVNEEHATOV
提出日時 2020-06-12 03:57:31
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 340 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 29,144 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 08:54:05
合計ジャッジ時間 2,034 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:9:17: 警告: 関数 ‘abs’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    9 |     while (a >> abs(i) != 0) {
      |                 ^~~
main.c:3:1: 備考: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main() {
    int a,b,i=0,count=0;
    scanf("%d %d",&a, &b);

    /* 桁数を計算 */
    while (a >> abs(i) != 0) {
        if ((a >> abs(i)) & 0x01 && (b >> abs(i)) & 0x01){
            count -= (int)pow(2, abs(i)) ;
        }
        i--;
    }
    printf("%d\n", (a|b)-count);
    return 0;
}
0