結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-12-05 18:19:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 989 ms / 5,000 ms
コード長 1,024 bytes
コンパイル時間 3,870 ms
コンパイル使用メモリ 80,496 KB
実行使用メモリ 69,552 KB
最終ジャッジ日時 2024-04-25 23:33:32
合計ジャッジ時間 28,879 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 886 ms
68,764 KB
testcase_01 AC 141 ms
54,412 KB
testcase_02 AC 634 ms
59,756 KB
testcase_03 AC 923 ms
69,204 KB
testcase_04 AC 905 ms
69,208 KB
testcase_05 AC 930 ms
69,108 KB
testcase_06 AC 952 ms
69,068 KB
testcase_07 AC 946 ms
68,732 KB
testcase_08 AC 971 ms
68,652 KB
testcase_09 AC 970 ms
69,040 KB
testcase_10 AC 929 ms
69,176 KB
testcase_11 AC 929 ms
69,144 KB
testcase_12 AC 926 ms
69,304 KB
testcase_13 AC 832 ms
69,136 KB
testcase_14 AC 925 ms
69,552 KB
testcase_15 AC 965 ms
69,212 KB
testcase_16 AC 916 ms
69,280 KB
testcase_17 AC 894 ms
69,368 KB
testcase_18 AC 966 ms
69,176 KB
testcase_19 AC 978 ms
68,628 KB
testcase_20 AC 989 ms
68,808 KB
testcase_21 AC 882 ms
68,948 KB
testcase_22 AC 972 ms
69,276 KB
testcase_23 AC 977 ms
69,244 KB
testcase_24 AC 129 ms
54,168 KB
testcase_25 AC 223 ms
57,812 KB
testcase_26 AC 200 ms
56,392 KB
testcase_27 AC 194 ms
54,752 KB
testcase_28 AC 446 ms
59,188 KB
testcase_29 AC 337 ms
58,836 KB
testcase_30 AC 230 ms
57,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0067 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int n = in.nextInt();
		int[] l = new int[n];
		int max = 0;
		for (int i=0; i<n; i++) {
			l[i] = in.nextInt();
			max = Math.max(max, l[i]);
		}
		long k = in.nextLong();

		double lb = 0, ub = max;
		for (int i=0; i<100; i++) {
			double m = (lb + ub)/2;
			if (cnt(l,m) >= k) lb = m;
			else ub = m;
		}

		out.printf("%.10f\n",ub);
	}

	static long cnt(int[] l, double m) {
		long res = 0;
		for (int i=0; i<l.length; i++) {
			res += (long)(l[i]/m);
		}
		return res;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0