結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー uchiiiiuchiiii
提出日時 2019-03-31 20:07:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,363 ms / 5,000 ms
コード長 1,039 bytes
コンパイル時間 1,954 ms
コンパイル使用メモリ 164,892 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-04-26 00:39:52
合計ジャッジ時間 33,929 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,363 ms
6,964 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 514 ms
6,944 KB
testcase_03 AC 978 ms
6,944 KB
testcase_04 AC 1,339 ms
6,944 KB
testcase_05 AC 1,330 ms
6,940 KB
testcase_06 AC 1,333 ms
6,940 KB
testcase_07 AC 1,356 ms
6,944 KB
testcase_08 AC 1,360 ms
6,944 KB
testcase_09 AC 1,356 ms
6,940 KB
testcase_10 AC 1,199 ms
6,944 KB
testcase_11 AC 1,269 ms
6,944 KB
testcase_12 AC 1,152 ms
6,944 KB
testcase_13 AC 1,243 ms
6,944 KB
testcase_14 AC 1,293 ms
6,940 KB
testcase_15 AC 1,146 ms
6,944 KB
testcase_16 AC 1,332 ms
6,940 KB
testcase_17 AC 1,332 ms
7,040 KB
testcase_18 AC 1,329 ms
6,944 KB
testcase_19 AC 1,356 ms
6,940 KB
testcase_20 AC 1,355 ms
6,940 KB
testcase_21 AC 1,357 ms
7,016 KB
testcase_22 AC 1,202 ms
6,944 KB
testcase_23 AC 1,269 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 28 ms
6,940 KB
testcase_26 AC 11 ms
6,940 KB
testcase_27 AC 8 ms
6,948 KB
testcase_28 AC 217 ms
6,944 KB
testcase_29 AC 109 ms
6,944 KB
testcase_30 AC 29 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll MOD=1e9+7 ;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//-------------------
const int MX = 200000 + 7;
const ld LMX = 1e10+10;
ld l[MX];
int n;
ll k;

ll num(ld leng){
	ll ans = 0;
	FOR(i,1,n){
		ans += l[i]/leng;
	}
	return ans;
}

ld lt = 0, rt = LMX, mid;

void solve(){	
	FOR(i,1,1000){
		mid = (lt+rt)/2;
		if(num(mid) < k) rt = mid;
		else lt = mid;
	}
}

int main(){
	cin >> n;
	FOR(i,1,n){
		cin >> l[i];
	}
	cin >> k;
	solve();	
	cout << fixed << setprecision(10) << mid;
    return 0;
}
0