結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー scachescache
提出日時 2015-06-08 12:07:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,261 ms / 5,000 ms
コード長 898 bytes
コンパイル時間 3,422 ms
コンパイル使用メモリ 77,500 KB
実行使用メモリ 73,148 KB
最終ジャッジ日時 2024-04-25 23:26:08
合計ジャッジ時間 34,818 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,180 ms
73,148 KB
testcase_01 AC 132 ms
53,040 KB
testcase_02 AC 789 ms
65,496 KB
testcase_03 AC 1,071 ms
69,220 KB
testcase_04 AC 1,170 ms
71,488 KB
testcase_05 AC 1,250 ms
71,604 KB
testcase_06 AC 1,228 ms
71,652 KB
testcase_07 AC 1,186 ms
70,564 KB
testcase_08 AC 1,223 ms
70,988 KB
testcase_09 AC 1,177 ms
71,124 KB
testcase_10 AC 1,155 ms
71,384 KB
testcase_11 AC 1,209 ms
71,736 KB
testcase_12 AC 1,126 ms
71,184 KB
testcase_13 AC 1,189 ms
71,324 KB
testcase_14 AC 1,153 ms
70,212 KB
testcase_15 AC 1,140 ms
71,224 KB
testcase_16 AC 1,249 ms
71,696 KB
testcase_17 AC 1,232 ms
71,864 KB
testcase_18 AC 1,261 ms
71,632 KB
testcase_19 AC 1,095 ms
71,080 KB
testcase_20 AC 1,219 ms
71,208 KB
testcase_21 AC 1,236 ms
70,780 KB
testcase_22 AC 1,140 ms
71,328 KB
testcase_23 AC 1,050 ms
70,988 KB
testcase_24 AC 115 ms
52,976 KB
testcase_25 AC 236 ms
57,656 KB
testcase_26 AC 203 ms
56,740 KB
testcase_27 AC 206 ms
54,792 KB
testcase_28 AC 522 ms
59,388 KB
testcase_29 AC 368 ms
59,404 KB
testcase_30 AC 230 ms
57,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.NumberFormat;
import java.util.Scanner;

public class Main0145 {

	public static void main(String[] args) {
		new Main0145();
	}

	public Main0145() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] l = new long[N];
		for(int i=0;i<N;i++)
			l[i] = sc.nextLong();
		long K = sc.nextLong();
		solve(N, l, K);
	}

	private void solve(int n, long[] l, long k) {
		double res = 0;
		double low = 0;
		double high = Integer.MAX_VALUE;
		
		for(int i=0;i<200;i++){
			long count = 0;
			double mid = (high+low)/2;
			
			for(long s: l){
				count += s/mid;
			}
//			System.out.println(count + " " + mid);
			if(count>=k){
				low = mid;
				res = mid;
			}else{
				high = mid;
			}
		}
		NumberFormat format = NumberFormat.getInstance();
		format.setGroupingUsed(false);
		format.setMaximumFractionDigits(11);
		
		System.out.println(format.format(res));
	}
}
0