結果
問題 | No.1465 Archaea |
ユーザー |
![]() |
提出日時 | 2025-03-31 17:34:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 826 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,060 KB |
実行使用メモリ | 53,700 KB |
最終ジャッジ日時 | 2025-03-31 17:35:00 |
合計ジャッジ時間 | 1,977 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
N, K = map(int, input().split())if N == 1:print("YES" if K >= 0 else "NO")else:found = False# Iterate possible m values (number of multiplies)for m in range(0, K + 1):pow2 = 1 << mif pow2 > N:breakresidual = N - pow2if residual < 0:continueif residual % 3 != 0:continuesum_terms = residual // 3current = sum_termssum_a = 0# Compute minimal sum_afor i in range(m + 1):exponent = m - icoeff = 1 << exponentai = current // coeffsum_a += aicurrent %= coeffif current == 0:breakif sum_a + m <= K:found = Truebreakprint("YES" if found else "NO")