結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー | fjafjafja |
提出日時 | 2017-09-20 21:30:13 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 601 bytes |
コンパイル時間 | 3,061 ms |
コンパイル使用メモリ | 72,404 KB |
実行使用メモリ | 68,492 KB |
最終ジャッジ日時 | 2023-08-08 03:26:00 |
合計ジャッジ時間 | 25,835 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 825 ms
64,880 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 910 ms
64,984 KB |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | AC | 978 ms
64,576 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | AC | 904 ms
65,192 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | AC | 934 ms
64,676 KB |
testcase_16 | AC | 966 ms
65,172 KB |
testcase_17 | AC | 914 ms
64,560 KB |
testcase_18 | AC | 902 ms
64,856 KB |
testcase_19 | AC | 981 ms
64,660 KB |
testcase_20 | AC | 973 ms
66,772 KB |
testcase_21 | AC | 969 ms
64,852 KB |
testcase_22 | AC | 843 ms
64,600 KB |
testcase_23 | AC | 849 ms
64,792 KB |
testcase_24 | AC | 121 ms
55,616 KB |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 198 ms
56,932 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
ソースコード
import java.util.Scanner; public class N067 { static double max=Integer.MAX_VALUE,min=Math.pow(10, -9),k; static int n; static int[] l; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n=sc.nextInt(); l=new int[n]; for(int i=0;i<n;i++) { l[i]=sc.nextInt(); } k=sc.nextInt(); double av=0; for(int i=0;i<100;i++) { av=(max+min)/2; int cnt=0; for(int j=0;j<n;j++) { cnt+=(int)(l[j]/av); if(cnt>=k) {break;} } if(cnt>=k) { min=av; } else { max=av; } } System.out.printf("%.8f",av); } }