結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー mbanmban
提出日時 2017-04-21 02:50:29
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 942 bytes
コンパイル時間 2,838 ms
コンパイル使用メモリ 105,112 KB
実行使用メモリ 49,012 KB
最終ジャッジ日時 2023-09-27 07:00:03
合計ジャッジ時間 15,877 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 497 ms
49,012 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 479 ms
40,840 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 483 ms
45,916 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 427 ms
39,760 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 424 ms
44,212 KB
testcase_16 AC 479 ms
40,984 KB
testcase_17 AC 479 ms
40,880 KB
testcase_18 AC 484 ms
40,964 KB
testcase_19 AC 482 ms
45,832 KB
testcase_20 AC 483 ms
43,828 KB
testcase_21 AC 485 ms
45,872 KB
testcase_22 AC 438 ms
42,008 KB
testcase_23 AC 463 ms
40,536 KB
testcase_24 AC 70 ms
23,800 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 78 ms
24,180 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static int N;
    static long K;
    static int[] L;

    static void Main(string[] args)
    {
        N = int.Parse(Console.ReadLine());
        L = Line().Select(int.Parse).ToArray();
        K = long.Parse(Console.ReadLine());

        double min = 0;
        double max = 1e9;
        for(int i = 0; i < 100; i++)
        {
            double mid = (min + max) / 2.0;
            int cnt = L.Sum(ii => ((int)(ii / mid)));
            if (cnt < K)
            {
                max = mid;
            }
            else
            {
                min = mid;
            }
        }

        Console.WriteLine(max);
    }

    static string[] Line()
    {
        return Console.ReadLine().Split(' ');
    }
}
0