結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー fjafjafjafjafjafja
提出日時 2017-09-20 21:41:37
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 619 bytes
コンパイル時間 4,259 ms
コンパイル使用メモリ 72,320 KB
実行使用メモリ 67,340 KB
最終ジャッジ日時 2023-09-08 18:29:30
合計ジャッジ時間 28,626 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 844 ms
66,696 KB
testcase_01 WA -
testcase_02 AC 627 ms
62,084 KB
testcase_03 AC 960 ms
66,500 KB
testcase_04 AC 864 ms
67,004 KB
testcase_05 AC 863 ms
66,572 KB
testcase_06 AC 873 ms
66,708 KB
testcase_07 AC 928 ms
66,660 KB
testcase_08 AC 924 ms
66,704 KB
testcase_09 AC 942 ms
67,004 KB
testcase_10 AC 854 ms
66,928 KB
testcase_11 AC 930 ms
66,984 KB
testcase_12 AC 857 ms
64,648 KB
testcase_13 AC 925 ms
66,504 KB
testcase_14 AC 906 ms
66,808 KB
testcase_15 AC 893 ms
64,828 KB
testcase_16 AC 922 ms
67,340 KB
testcase_17 AC 883 ms
67,048 KB
testcase_18 AC 860 ms
66,720 KB
testcase_19 AC 898 ms
66,432 KB
testcase_20 AC 909 ms
66,524 KB
testcase_21 AC 922 ms
67,212 KB
testcase_22 AC 788 ms
67,080 KB
testcase_23 AC 802 ms
67,268 KB
testcase_24 AC 124 ms
56,052 KB
testcase_25 AC 232 ms
59,772 KB
testcase_26 AC 205 ms
59,156 KB
testcase_27 AC 198 ms
56,480 KB
testcase_28 AC 437 ms
60,868 KB
testcase_29 AC 334 ms
60,652 KB
testcase_30 AC 229 ms
59,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N067
{
	static double max=Integer.MAX_VALUE,min=Math.pow(10, -9);
	static long k;
	static int n;
	static long[] l;
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();

		l=new long[n];
		for(int i=0;i<n;i++)
		{
			l[i]=sc.nextInt();
		}
		k=sc.nextLong();

		double av=0;
		for(int i=0;i<100;i++)
		{
			av=(max+min)/2;
			long cnt=0;
			for(int j=0;j<n;j++)
			{
				cnt+=(long)(l[j]/av);
				if(cnt>=k)
				{break;}
			}

			if(cnt>=k)
			{
				min=av;
			}
			else
			{
				max=av;
			}
		}
		System.out.printf("%.8f",av);
	}
}
0