結果
問題 | No.1862 Copy and Paste |
ユーザー |
|
提出日時 | 2021-12-26 17:08:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-13 09:21:27 |
合計ジャッジ時間 | 2,316 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
def main():from math import inf, ceila, b = map(int, input().split())n = int(input())if n == 1:print(0)exit()ans = inffor i in range(1, n + 1):root = ceil(n ** (1 / i))ok, ng = 0, iwhile ng - ok > 1:mid = (ok + ng) // 2if (root - 1) ** mid * root ** (i - mid) >= n:ok = midelse:ng = midans = min(ans, (a + b * (root - 2)) * ok + (a + b * (root - 1)) * (i - ok))if root == 2:breakprint(ans)if __name__ == '__main__':main()