結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー amtgjwamtgjw
提出日時 2018-07-11 21:59:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 846 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 5,132 KB
最終ジャッジ日時 2023-10-21 22:19:58
合計ジャッジ時間 7,091 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 82 ms
4,348 KB
testcase_03 AC 156 ms
4,548 KB
testcase_04 AC 194 ms
5,088 KB
testcase_05 AC 194 ms
5,088 KB
testcase_06 AC 195 ms
5,088 KB
testcase_07 AC 216 ms
5,088 KB
testcase_08 AC 217 ms
5,088 KB
testcase_09 WA -
testcase_10 AC 175 ms
4,684 KB
testcase_11 AC 185 ms
4,900 KB
testcase_12 AC 168 ms
4,656 KB
testcase_13 AC 199 ms
4,696 KB
testcase_14 AC 205 ms
4,900 KB
testcase_15 AC 184 ms
4,648 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 6 ms
4,348 KB
testcase_26 AC 3 ms
4,348 KB
testcase_27 AC 3 ms
4,348 KB
testcase_28 AC 35 ms
4,348 KB
testcase_29 AC 19 ms
4,348 KB
testcase_30 AC 7 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <math.h>
#include <cstring>

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)

#define INF 		2000000007
#define MOD			998244353

#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int ll;


bool check(double n,ll K,vector<uint> a){
	for(auto t : a)
		K -= floor(t/n);
	return (K<=0);
}

int main(void) {
	int N;cin>>N;
	vector<uint> L(N);
	REP(i,N)cin>>L[i];
	ll K;cin>>K;

	double l=1e-6,r=1e6;
	double middle = (l+r)/2;
	REP(i,100){
		if(check(middle,K,L)){
			l = middle;
			middle = (l+r)/2;
		}
		else{
			r = middle;
			middle = (l+r)/2;
		}
	}
	printf("%0.7lf\n",middle);

    return 0;
}
0