結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2014-11-17 00:19:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 169 ms / 5,000 ms |
| コード長 | 727 bytes |
| コンパイル時間 | 987 ms |
| コンパイル使用メモリ | 76,856 KB |
| 実行使用メモリ | 8,604 KB |
| 最終ジャッジ日時 | 2025-03-03 10:09:47 |
| 合計ジャッジ時間 | 5,442 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <cctype>
using namespace std;
int main(){
long n,k;
cin>>n;
vector<long> L(n);
for(long i=0;i<n;i++) cin>>L[i];
cin>>k;
// sort(L.begin(),L.end());
// if(n>=k) cout<<L[n-k];
// else{
double l=0,r=1e9,m;
for(int i=0;i<(1<<8);i++){
long num=0;
m=(l+r)/2.0;
for(long j=0;j<n;j++) num+=(long)(L[j]/m);
// cout<<"m="<<m<<"->"<<num<<endl;
if(num<k) r=m;
else{
l=m;
}
}
printf("%.16f\n",m);
// }
return 0;
}
Lay_ec