結果

問題 No.683 Two Operations No.3
ユーザー kamome
提出日時 2019-07-04 22:18:11
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-19 06:47:41
合計ジャッジ時間 3,750 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 3 TLE * 1 -- * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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==1)&&(y%2==1)){
        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==1){
        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