結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー fjafjafjafjafjafja
提出日時 2017-09-20 21:35:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 3,085 ms
コンパイル使用メモリ 72,100 KB
実行使用メモリ 66,536 KB
最終ジャッジ日時 2023-08-08 03:27:25
合計ジャッジ時間 26,896 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 812 ms
65,304 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 865 ms
64,736 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 890 ms
65,024 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 823 ms
65,296 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 867 ms
64,928 KB
testcase_16 AC 899 ms
64,688 KB
testcase_17 AC 847 ms
64,596 KB
testcase_18 AC 827 ms
64,872 KB
testcase_19 AC 884 ms
65,088 KB
testcase_20 AC 880 ms
64,656 KB
testcase_21 AC 894 ms
64,996 KB
testcase_22 AC 783 ms
65,024 KB
testcase_23 AC 786 ms
64,940 KB
testcase_24 AC 122 ms
56,048 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 198 ms
56,468 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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 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.nextLong();

		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);
	}
}
0