結果

問題 No.683 Two Operations No.3
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-22 15:17:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 8,220 KB
最終ジャッジ日時 2023-08-23 20:32:01
合計ジャッジ時間 1,181 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 19 ms
8,140 KB
testcase_05 AC 17 ms
8,220 KB
testcase_06 AC 16 ms
7,884 KB
testcase_07 AC 15 ms
7,768 KB
testcase_08 AC 16 ms
7,840 KB
testcase_09 AC 17 ms
7,864 KB
testcase_10 AC 16 ms
7,768 KB
testcase_11 AC 16 ms
7,848 KB
testcase_12 AC 16 ms
7,840 KB
testcase_13 AC 17 ms
7,804 KB
testcase_14 AC 16 ms
7,768 KB
testcase_15 AC 16 ms
7,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)
A,B=map(int,input().split())
ans=0

def cal(a,b):
    global ans
    if a % 2 == 1 and b % 2 == 1:
        return 0
    if a < 0 or b < 0:
        return 0
    if a == 0 or b == 0:
        return 1

    else:
        if a%2==0:
            ans=max(cal(a//2,b-1),ans)
        if b%2==0:
            ans=max(cal(a-1,b//2),ans)

    return ans

    
print('Yes' if cal(A,B) else 'No')

    
    
    
0