結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2014-11-16 23:52:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 433 ms / 5,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 666 ms |
コンパイル使用メモリ | 58,876 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 10:05:23 |
合計ジャッジ時間 | 11,360 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream>#include <cstdio>typedef long long ll;int N;ll K;double L[200000];bool can(double x){ll k = 0;for(int i=0;i<N;i++){k += static_cast<int>(L[i] / x);}return k >= K;}int main(){std::cin >> N;for(int i=0;i<N;i++){std::cin >> L[i];}std::cin >> K;double lb = 0.0, ub = 1000000100.0;for(int i=0;i<1000;i++){double mid = (lb+ub) / 2.0;if(can(mid)){lb = mid;}else{ub = mid;}}printf("%.30f\n", lb);}