結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー scachescache
提出日時 2015-06-08 12:07:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,088 ms / 5,000 ms
コード長 898 bytes
コンパイル時間 5,517 ms
コンパイル使用メモリ 74,256 KB
実行使用メモリ 68,264 KB
最終ジャッジ日時 2023-08-08 05:52:36
合計ジャッジ時間 31,009 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,043 ms
66,436 KB
testcase_01 AC 140 ms
55,748 KB
testcase_02 AC 697 ms
64,580 KB
testcase_03 AC 932 ms
64,728 KB
testcase_04 AC 988 ms
66,648 KB
testcase_05 AC 976 ms
66,424 KB
testcase_06 AC 1,009 ms
64,508 KB
testcase_07 AC 1,060 ms
66,988 KB
testcase_08 AC 1,069 ms
66,448 KB
testcase_09 AC 1,055 ms
66,820 KB
testcase_10 AC 958 ms
66,536 KB
testcase_11 AC 1,003 ms
66,984 KB
testcase_12 AC 955 ms
64,492 KB
testcase_13 AC 1,018 ms
67,028 KB
testcase_14 AC 1,031 ms
66,740 KB
testcase_15 AC 1,014 ms
64,608 KB
testcase_16 AC 1,032 ms
67,308 KB
testcase_17 AC 987 ms
66,916 KB
testcase_18 AC 965 ms
66,732 KB
testcase_19 AC 1,031 ms
66,512 KB
testcase_20 AC 1,057 ms
66,716 KB
testcase_21 AC 1,088 ms
66,664 KB
testcase_22 AC 937 ms
64,384 KB
testcase_23 AC 941 ms
68,264 KB
testcase_24 AC 120 ms
55,560 KB
testcase_25 AC 225 ms
59,112 KB
testcase_26 AC 197 ms
58,552 KB
testcase_27 AC 194 ms
56,304 KB
testcase_28 AC 469 ms
60,284 KB
testcase_29 AC 356 ms
59,860 KB
testcase_30 AC 237 ms
59,636 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