結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2017-09-20 21:30:13 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 601 bytes |
コンパイル時間 | 3,724 ms |
コンパイル使用メモリ | 77,128 KB |
実行使用メモリ | 70,112 KB |
最終ジャッジ日時 | 2025-03-03 10:54:07 |
合計ジャッジ時間 | 23,879 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 RE * 16 |
ソースコード
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); } }