結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  Lay_ec | 
| 提出日時 | 2014-11-16 23:58:50 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 769 bytes | 
| コンパイル時間 | 1,072 ms | 
| コンパイル使用メモリ | 81,840 KB | 
| 実行使用メモリ | 8,608 KB | 
| 最終ジャッジ日時 | 2025-03-03 10:05:30 | 
| 合計ジャッジ時間 | 9,993 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 WA * 8 TLE * 1 -- * 20 | 
ソースコード
#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 res=0;
		double l=0,r=L[n-1];
		while((r-l)>1e-10){
			unsigned long long num=0;
			double m=(l+r)/2.0;
			for(long i=0;i<n;i++) num+=floor(L[i]/m);
//			cout<<"m="<<m<<"->"<<num<<endl;
			if(num<k) r=m;
			else{
				res=max(res,m);
				l=m;
			}
		}
		cout<<res<<endl;
	}
	return 0;
}
            
            
            
        