結果

問題 No.2063 ±2^k operations (easy)
ユーザー イルカイルカ
提出日時 2024-06-10 23:26:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 626 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,696 KB
実行使用メモリ 273,468 KB
最終ジャッジ日時 2024-06-10 23:26:19
合計ジャッジ時間 4,874 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
57,088 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 36 ms
52,096 KB
testcase_03 AC 38 ms
52,096 KB
testcase_04 AC 36 ms
52,096 KB
testcase_05 AC 35 ms
51,968 KB
testcase_06 AC 36 ms
51,968 KB
testcase_07 AC 39 ms
52,096 KB
testcase_08 AC 36 ms
51,712 KB
testcase_09 AC 37 ms
51,968 KB
testcase_10 AC 39 ms
51,840 KB
testcase_11 AC 40 ms
51,712 KB
testcase_12 AC 40 ms
52,352 KB
testcase_13 AC 39 ms
52,096 KB
testcase_14 AC 38 ms
51,968 KB
testcase_15 AC 37 ms
51,968 KB
testcase_16 AC 36 ms
52,096 KB
testcase_17 AC 43 ms
57,728 KB
testcase_18 AC 50 ms
63,104 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 演算の順序は考慮しなくてよさそう
# nは正の整数なので(+,-),(-,-)が考えられる演算子の組み合わせ
# (+,-) X+2^a-2^b=0よりX=2^a(2^(b-a)-1)
# (-,-) X-2^a-2^b=0よりX=2^a(2^(b-a)+1)
# Xを2のべき乗で割れるだけ割ってみて、結果が(2のべき乗+1)ならよさそう(ただしb=aはf(N)=1になりダメ)
N = int(input(),2)
if list(bin(N)).count('1') == 1:
    print("No")
    exit()
while True:
    if list(bin(N-1)).count('1') == 1 or list(bin(N+1)).count('1') == 1:
        print("Yes")
        exit()
    if N % 2 != 0:
        break
    N = N // 2
print("No")
"🐬❓"
0