結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2017-09-20 21:21:54 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 816 bytes |
コンパイル時間 | 3,723 ms |
コンパイル使用メモリ | 80,008 KB |
実行使用メモリ | 70,316 KB |
最終ジャッジ日時 | 2025-03-03 10:54:02 |
合計ジャッジ時間 | 26,264 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 RE * 16 |
ソースコード
import java.util.Scanner;public class N067{static double max=Integer.MAX_VALUE,min=Math.pow(10, -9),ans,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();nibun(min,max);System.out.printf("%.8f",ans);}static void nibun(double min,double max){double av=0;for(int i=0;i<100;i++){av=(max+min)/2;if(isok(av)){min=av;}else{max=av;}}ans=av;return;}static boolean isok(double a){int cnt=0;int end=0;for(int i=0;end==0&&i<n;i++){cnt+=(int)(l[i]/a);if(cnt>=k){end=1;}}if(end==1){return true;}else{return false;}}}