結果

問題 No.1465 Archaea
ユーザー convexineq
提出日時 2021-04-03 06:54:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-12-24 07:10:56
合計ジャッジ時間 1,985 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(i,n,k):
    # 1,2,4,....,2**i 合計 k 回以下で n が作れる?
    return n//(1<<i) + bin(n%(1<<i)).count("1") <= k

n,k = map(int,input().split())
for i in range(20):
    nn = n-2**i
    if i > k or nn%3 or nn < 0: continue
    if check(i,nn//3,k-i):
        print("YES")
        exit()
print("NO")
0