結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nanophoto12nanophoto12
提出日時 2014-11-17 23:20:32
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 834 bytes
コンパイル時間 3,511 ms
コンパイル使用メモリ 104,796 KB
実行使用メモリ 49,216 KB
最終ジャッジ日時 2023-08-30 20:30:39
合計ジャッジ時間 11,904 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 233 ms
49,216 KB
testcase_01 AC 64 ms
23,628 KB
testcase_02 AC 132 ms
32,504 KB
testcase_03 AC 192 ms
43,116 KB
testcase_04 AC 230 ms
41,384 KB
testcase_05 AC 231 ms
41,480 KB
testcase_06 AC 233 ms
41,580 KB
testcase_07 AC 238 ms
44,336 KB
testcase_08 AC 237 ms
46,364 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

internal class Program
{
    public static void Main(string[] args)
    {
        var n = long.Parse(Console.ReadLine());
        var ls = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var k = long.Parse(Console.ReadLine());

        double minValue = 0;
        double maxValue = 1e9;

        while (maxValue - minValue > 1e-10)
        {
            double mid = (minValue + maxValue)/2d;
            long sum = 0;
            for (int i = 0; i < n; i++)
            {
                sum += (long)(ls[i]/mid);
            }
            if (sum >= k)
            {
                minValue = mid;
            }
            else
            {
                maxValue = mid;
            }
        }
        Console.WriteLine(minValue);
    }
}
0