結果

問題 No.683 Two Operations No.3
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-05-12 00:55:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 4,294 ms
コンパイル使用メモリ 77,936 KB
実行使用メモリ 57,824 KB
最終ジャッジ日時 2023-09-10 18:14:17
合計ジャッジ時間 6,228 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,532 KB
testcase_01 AC 123 ms
56,024 KB
testcase_02 AC 124 ms
56,148 KB
testcase_03 AC 125 ms
54,244 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 123 ms
55,708 KB
testcase_07 AC 125 ms
55,920 KB
testcase_08 AC 125 ms
55,768 KB
testcase_09 WA -
testcase_10 AC 127 ms
56,092 KB
testcase_11 AC 124 ms
55,992 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 124 ms
55,524 KB
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        boolean ans = rec(a, b);
        if(ans)
            System.out.println("Yes");
        else
            System.out.println("No");
    }

    private static boolean rec(long i, long j) {
        if(i == 0 || j == 0) return true;

        boolean b = false;
        if(i % 2 == 0) b = rec(i / 2, j - 1);
        if(j % 2 == 0) b = rec(i - 1, j / 2);

        return b;
    }
}
0