結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー 37zigen37zigen
提出日時 2016-03-20 19:08:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,259 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 2,142 ms
コンパイル使用メモリ 74,644 KB
実行使用メモリ 73,924 KB
最終ジャッジ日時 2024-04-25 23:42:23
合計ジャッジ時間 31,991 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,091 ms
73,900 KB
testcase_01 AC 140 ms
54,312 KB
testcase_02 AC 681 ms
62,600 KB
testcase_03 AC 1,069 ms
73,448 KB
testcase_04 AC 1,253 ms
73,604 KB
testcase_05 AC 1,259 ms
73,924 KB
testcase_06 AC 1,123 ms
73,484 KB
testcase_07 AC 1,091 ms
72,732 KB
testcase_08 AC 1,118 ms
72,512 KB
testcase_09 AC 1,076 ms
73,132 KB
testcase_10 AC 1,023 ms
73,560 KB
testcase_11 AC 1,060 ms
73,536 KB
testcase_12 AC 1,085 ms
73,408 KB
testcase_13 AC 1,012 ms
73,308 KB
testcase_14 AC 1,072 ms
72,548 KB
testcase_15 AC 1,127 ms
73,376 KB
testcase_16 AC 1,075 ms
73,528 KB
testcase_17 AC 1,210 ms
73,628 KB
testcase_18 AC 1,195 ms
73,552 KB
testcase_19 AC 1,075 ms
73,272 KB
testcase_20 AC 996 ms
72,360 KB
testcase_21 AC 1,103 ms
73,452 KB
testcase_22 AC 996 ms
73,444 KB
testcase_23 AC 1,073 ms
73,316 KB
testcase_24 AC 115 ms
53,096 KB
testcase_25 AC 247 ms
57,664 KB
testcase_26 AC 205 ms
56,612 KB
testcase_27 AC 211 ms
54,644 KB
testcase_28 AC 539 ms
59,436 KB
testcase_29 AC 409 ms
59,404 KB
testcase_30 AC 246 ms
57,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		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();
		double sup=Integer.MAX_VALUE;//不可能な長さ
		double low=0;//可能な長さ
		for(int i=0;i<300;i++){
			long count=0;
			double mid=(sup+low)/2;
			for(int j=0;j<n;j++){
				count+=(long)(int)(L[j]/mid);
			}
			if(count>=k){
				low=mid;
			}else{
				sup=mid;
			}
			
		}
		System.out.println(low);
	}
}
0