結果
| 問題 | No.67 よくある棒を切る問題 (1) |
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2014-11-17 00:14:57 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 722 bytes |
| 記録 | |
| コンパイル時間 | 726 ms |
| コンパイル使用メモリ | 81,064 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-03-03 10:09:02 |
| 合計ジャッジ時間 | 5,242 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 WA * 2 |
ソースコード
#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=L[n-1],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