結果

問題 No.683 Two Operations No.3
ユーザー kamome
提出日時 2019-07-04 22:26:34
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 28,160 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 06:47:57
合計ジャッジ時間 1,215 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
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