結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー threepipes_sthreepipes_s
提出日時 2014-11-17 01:01:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 402 ms / 5,000 ms
コード長 920 bytes
コンパイル時間 2,795 ms
コンパイル使用メモリ 77,776 KB
実行使用メモリ 77,596 KB
最終ジャッジ日時 2024-04-25 23:11:18
合計ジャッジ時間 13,923 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 398 ms
77,164 KB
testcase_01 AC 56 ms
50,672 KB
testcase_02 AC 275 ms
62,908 KB
testcase_03 AC 384 ms
71,892 KB
testcase_04 AC 396 ms
75,200 KB
testcase_05 AC 390 ms
74,916 KB
testcase_06 AC 395 ms
75,044 KB
testcase_07 AC 402 ms
76,876 KB
testcase_08 AC 386 ms
76,552 KB
testcase_09 AC 380 ms
76,728 KB
testcase_10 AC 354 ms
73,416 KB
testcase_11 AC 387 ms
74,020 KB
testcase_12 AC 366 ms
73,156 KB
testcase_13 AC 385 ms
77,040 KB
testcase_14 AC 395 ms
77,596 KB
testcase_15 AC 395 ms
74,104 KB
testcase_16 AC 394 ms
75,268 KB
testcase_17 AC 397 ms
75,136 KB
testcase_18 AC 387 ms
75,244 KB
testcase_19 AC 394 ms
76,712 KB
testcase_20 AC 394 ms
76,680 KB
testcase_21 AC 397 ms
76,916 KB
testcase_22 AC 342 ms
73,272 KB
testcase_23 AC 398 ms
73,524 KB
testcase_24 AC 54 ms
50,584 KB
testcase_25 AC 110 ms
54,132 KB
testcase_26 AC 78 ms
53,376 KB
testcase_27 AC 65 ms
50,700 KB
testcase_28 AC 195 ms
60,784 KB
testcase_29 AC 138 ms
55,584 KB
testcase_30 AC 109 ms
54,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args){
		BufferedReader input
		= new BufferedReader(new InputStreamReader(System.in));
		try{
			int n = Integer.parseInt(input.readLine().trim());
			String tmp0[] = input.readLine().trim().split(" ");
			long m = Long.parseLong(input.readLine().trim());
			double[] l = new double[n];
			double min = 0;
			double max = 1e10;
			
			for(int i=0; i<n; i++){
				l[i] = Double.parseDouble(tmp0[i]);
			}
			double len = 0;
			long cut;
			for(int i=0; i<100; i++){
				len = (min+max)/2.0;
				cut = 0;
				for(int j=0; j<n; j++){
					cut += (long)(l[j]/len);
				}
				if(cut < m){
					max = len;
				}else{
					min = len;
				}
			}
			
			
			System.out.println(len);
		}catch(IOException e){
			e.printStackTrace();
		}
	}

}
0