結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
|
提出日時 | 2016-03-20 19:08:10 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 1,124 ms / 5,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 2,432 ms |
コンパイル使用メモリ | 76,792 KB |
実行使用メモリ | 74,420 KB |
最終ジャッジ日時 | 2025-03-03 10:34:08 |
合計ジャッジ時間 | 31,174 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Long[] L=new Long[n]; for(int i=0;i<n;i++){ L[i]=sc.nextLong(); } long k=sc.nextLong(); double sup=Integer.MAX_VALUE;//不可能な長さ double low=0;//可能な長さ for(int i=0;i<300;i++){ long count=0; double mid=(sup+low)/2; for(int j=0;j<n;j++){ count+=(long)(int)(L[j]/mid); } if(count>=k){ low=mid; }else{ sup=mid; } } System.out.println(low); } }