結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー kou6839kou6839
提出日時 2014-12-10 13:18:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,194 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 1,890 ms
コンパイル使用メモリ 74,032 KB
実行使用メモリ 69,356 KB
最終ジャッジ日時 2024-04-25 23:15:14
合計ジャッジ時間 54,427 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,165 ms
68,820 KB
testcase_01 AC 125 ms
54,376 KB
testcase_02 AC 1,199 ms
69,120 KB
testcase_03 AC 1,696 ms
69,160 KB
testcase_04 AC 2,194 ms
69,288 KB
testcase_05 AC 2,160 ms
69,300 KB
testcase_06 AC 2,184 ms
69,072 KB
testcase_07 AC 2,149 ms
68,652 KB
testcase_08 AC 2,084 ms
68,576 KB
testcase_09 AC 2,118 ms
68,536 KB
testcase_10 AC 1,928 ms
69,300 KB
testcase_11 AC 2,109 ms
69,168 KB
testcase_12 AC 1,929 ms
69,164 KB
testcase_13 AC 2,033 ms
69,356 KB
testcase_14 AC 2,103 ms
68,224 KB
testcase_15 AC 1,952 ms
69,228 KB
testcase_16 AC 2,141 ms
69,320 KB
testcase_17 AC 2,099 ms
69,160 KB
testcase_18 AC 2,041 ms
69,340 KB
testcase_19 AC 2,080 ms
68,592 KB
testcase_20 AC 2,117 ms
68,496 KB
testcase_21 AC 2,112 ms
69,012 KB
testcase_22 AC 2,040 ms
69,264 KB
testcase_23 AC 2,137 ms
69,192 KB
testcase_24 AC 117 ms
53,460 KB
testcase_25 AC 258 ms
58,504 KB
testcase_26 AC 208 ms
57,024 KB
testcase_27 AC 207 ms
54,496 KB
testcase_28 AC 680 ms
59,304 KB
testcase_29 AC 483 ms
59,152 KB
testcase_30 AC 269 ms
58,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] tree = new int[n];
        double max=0;
        for(int i=0;i<n;i++){
        	int temp=sc.nextInt();
        	tree[i]=temp;
        	max=Math.max(temp,max);
        }
        long k = sc.nextLong();
        double min=0;
        for(int hh=0;hh<1000;hh++){
        	double temp=(min+max)/2;
        	long count=0;
        	for(int i=0;i<n;i++){
        		count+=(long)tree[i]/temp;
        	}
        	if(count>=k){
        		min=temp;
        	}else{
        		max=temp;
        	}
        }
        System.out.println(max);
    }
}	
0