結果

問題 No.683 Two Operations No.3
ユーザー roarisroaris
提出日時 2019-09-01 20:00:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 405 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 8,520 KB
最終ジャッジ日時 2023-08-19 12:13:41
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,780 KB
testcase_01 AC 14 ms
7,788 KB
testcase_02 AC 14 ms
7,784 KB
testcase_03 AC 13 ms
7,804 KB
testcase_04 AC 15 ms
7,812 KB
testcase_05 AC 14 ms
7,776 KB
testcase_06 RE -
testcase_07 AC 13 ms
7,740 KB
testcase_08 RE -
testcase_09 AC 14 ms
8,140 KB
testcase_10 AC 14 ms
7,788 KB
testcase_11 AC 14 ms
7,840 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 13 ms
7,828 KB
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(A, B):
    if A == 0 and B == 0:
        return True
    elif A % 2 == 0 and B % 2 == 0 and A > 0 and B > 0:
        return dfs(A//2, B-1) or dfs(A-1, B//2)
    elif A % 2 == 0 and B > 0:
        return dfs(A//2, B-1)
    elif B % 2 == 0 and A > 0:
        return dfs(A-1, B//2)
    else:
        return False

A, B = map(int, input().split())

if dfs(A, B):
    print('Yes')
else:
    print('No')
0