結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-03-08 20:34:18 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,877 ms / 5,000 ms |
| コード長 | 680 bytes |
| コンパイル時間 | 317 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 26,764 KB |
| 最終ジャッジ日時 | 2025-03-03 10:30:40 |
| 合計ジャッジ時間 | 33,052 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
import math
def compute_max_length(n, ls, k):
if k == 1:
return max(ls)
eps = 10.0 ** (-10)
high = 10.0 ** 9
low = eps
while high - low > eps and (high - low) / low > eps:
mid = (high + low) / 2
num_of_sticks = sum(math.floor(l / mid) for l in ls)
if num_of_sticks >= k:
low = mid
else:
high = mid
return (high + low) / 2
def main():
n = int(input())
ls = array.array("L", map(int, input().split()))
k = int(input())
print("{:.16f}".format(compute_max_length(n, ls, k)))
if __name__ == '__main__':
main()
はむ吉🐹