結果

問題 No.683 Two Operations No.3
ユーザー kamomekamome
提出日時 2019-07-04 22:26:34
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 800 ms
コンパイル使用メモリ 29,020 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 10:37:42
合計ジャッジ時間 907 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'op':
main.c:6:13: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
    6 |             exit(0);
      |             ^~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | long int a,b;
main.c:6:13: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
    6 |             exit(0);
      |             ^~~~
main.c:6:13: note: include '<stdlib.h>' or provide a declaration of 'exit'

ソースコード

diff #

#include <stdio.h>
long int a,b;
void op(long int x,long int y){
        if (x==0 | y==0){
            printf("Yes\n");
            exit(0);
        }
    if ((x%2==1)&&(y%2==1)){
        return;
    }
    else if((x%2==0)&&(y%2==0)){
        if ((x/2)%2==1){
            op(x-1,y/2);
        }
        else if ((y/2)%2==1){
            op(x/2,y-1);
        }
        else{
            op(x-1,y/2);
            op(x/2,y-1);
        }
    }
    else if (x%2==0){
        op(x/2,y-1);
    }
    else{
        op(x-1,y/2);
    }
}
int main(){
    scanf("%ld %ld",&a,&b);
    op(a,b);
    printf("No\n");
    return 0;
}
0