結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nanophoto12
提出日時 2014-11-17 23:23:47
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 834 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 110,912 KB
実行使用メモリ 59,532 KB
最終ジャッジ日時 2025-03-03 10:11:58
合計ジャッジ時間 9,620 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
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