結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
hang_hang_cln
|
| 提出日時 | 2018-06-14 22:04:03 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 777 bytes |
| コンパイル時間 | 139 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 32,380 KB |
| 最終ジャッジ日時 | 2025-03-03 11:15:25 |
| 合計ジャッジ時間 | 26,507 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 1 -- * 13 |
ソースコード
N = int(input())
stickList = list(map(int,input().split()))
K = int(input())
def countCuttedSticks(stickList, cutLength):
count = 0
for stick in stickList:
count += stick // cutLength
return count
def main():
low = 0
high = max(stickList)
if countCuttedSticks(stickList, high) == K:
print(high)
else:
previousAns = -1
while(high - low >= 2 * 10** -9):
ans = (low + high) / 2
if countCuttedSticks(stickList, ans) >= K: # 本数を少なくするために切る長さを長くする
low = ans
else: # 本数を多くするために切る長さを短くする
high = ans
print(ans)
if __name__ == '__main__':
main()
hang_hang_cln