結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー picakunpicakun
提出日時 2017-06-06 23:04:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 818 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 72,552 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-25 23:50:32
合計ジャッジ時間 4,686 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 54 ms
6,940 KB
testcase_03 AC 102 ms
6,944 KB
testcase_04 AC 123 ms
6,944 KB
testcase_05 AC 123 ms
6,940 KB
testcase_06 AC 115 ms
6,940 KB
testcase_07 AC 141 ms
6,940 KB
testcase_08 AC 141 ms
6,944 KB
testcase_09 AC 133 ms
6,940 KB
testcase_10 AC 112 ms
6,944 KB
testcase_11 AC 117 ms
6,940 KB
testcase_12 AC 100 ms
6,940 KB
testcase_13 AC 129 ms
6,944 KB
testcase_14 AC 134 ms
6,940 KB
testcase_15 AC 114 ms
6,944 KB
testcase_16 AC 104 ms
6,944 KB
testcase_17 AC 101 ms
6,944 KB
testcase_18 AC 97 ms
6,948 KB
testcase_19 AC 119 ms
6,940 KB
testcase_20 AC 119 ms
6,940 KB
testcase_21 AC 119 ms
6,944 KB
testcase_22 AC 87 ms
6,940 KB
testcase_23 AC 93 ms
6,940 KB
testcase_24 AC 2 ms
6,948 KB
testcase_25 AC 4 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 24 ms
6,940 KB
testcase_29 AC 14 ms
6,940 KB
testcase_30 AC 5 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<iomanip>
#define REP(i,s,e) for(int i = s; i < e; i++)
#define PREP(i,s,e) for(int i = s; i >= e; i--)
#define rep(i,n) REP(i,0,n)

using namespace std;
int N;
int L[200000];

long long cut(float length){
	long long ans=0;
	rep(i,N)
		ans += L[i]/length;
	return ans;
}


int main(){
	cin >> N;
	int l[N];
	int M=0;
	rep(i,N)
		cin >> L[i];
	long long K;
	cin >> K;
	double high,low;
	low = 0.0;
	high = 1000000000;
	double middle;
	while(low + 1e-9 < high && low * (1 + 1e-9) < high){
		//temp = cut(middle);
		long long temp = 0;
		middle = (low + high) / 2;
		rep(i,N) temp += L[i]/middle;
		if(temp < K)
			high = middle;
		else
			low = middle;
	}
	cout << fixed << setprecision(10) << middle <<endl;
	return 0;
}
0