結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー okok
提出日時 2018-10-07 16:08:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 225 ms / 5,000 ms
コード長 1,009 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 66,940 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:35:36
合計ジャッジ時間 6,962 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 86 ms
6,940 KB
testcase_03 AC 164 ms
6,944 KB
testcase_04 AC 198 ms
6,944 KB
testcase_05 AC 201 ms
6,940 KB
testcase_06 AC 201 ms
6,940 KB
testcase_07 AC 221 ms
6,944 KB
testcase_08 AC 219 ms
6,940 KB
testcase_09 AC 222 ms
6,944 KB
testcase_10 AC 186 ms
6,940 KB
testcase_11 AC 193 ms
6,940 KB
testcase_12 AC 175 ms
6,944 KB
testcase_13 AC 204 ms
6,940 KB
testcase_14 AC 216 ms
6,944 KB
testcase_15 AC 190 ms
6,944 KB
testcase_16 AC 203 ms
6,940 KB
testcase_17 AC 202 ms
6,944 KB
testcase_18 AC 198 ms
6,944 KB
testcase_19 AC 224 ms
6,940 KB
testcase_20 AC 225 ms
6,940 KB
testcase_21 AC 224 ms
6,940 KB
testcase_22 AC 182 ms
6,944 KB
testcase_23 AC 193 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 6 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 3 ms
6,940 KB
testcase_28 AC 37 ms
6,944 KB
testcase_29 AC 19 ms
6,944 KB
testcase_30 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define MAX_N (int)(2*1e5+10)
#define MAX_V 10
#define MAX_M 101
#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")
#define pro "はいプロ 世界一○○が上手 ○○界のtourist ○○時代の終焉を告げる者 実質○○ ○○するために生まれてきた男"

int L[MAX_N];
signed main(){
	cout<<fixed<<setprecision(10);
	int N, K, sum = 0;
	double high, low, mid;
	cin>>N;
	rep(i,N){
		cin>>L[i];
		sum += L[i];
	}
	cin>>K;
	sort(L,L+N);
	low = L[0]/K; high = (double)sum/K+1;
	
	for(int i = 0; i <= 100; i++){
		mid = (low + high)/2;
		int count = 0;
		for(int i = 0; i < N; i++){
			count += L[i]/mid;
		}
		if(count >= K) low = mid;
		else if(count < K) high = mid;
		// cout<<count<<" "<<mid<<endl;
		// cin>>count;
	}
	cout<<mid<<endl;
	return 0;
}
0