結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー Yuuki77Yuuki77
提出日時 2018-01-07 16:21:49
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 942 bytes
コンパイル時間 3,972 ms
コンパイル使用メモリ 104,360 KB
実行使用メモリ 46,224 KB
最終ジャッジ日時 2023-08-24 23:34:59
合計ジャッジ時間 12,470 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abs001_2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] L = Array.ConvertAll(Console.ReadLine().Split(' '),s => int.Parse(s));
            int K = int.Parse(Console.ReadLine());

            int min = 0;
            int max = int.MaxValue;
       
            for (var i = 0; i < 100; i++)
            {
                var middle = (max + min) / 2;

                if (check(middle, K)) min = middle;
                else max = middle;
            }

            Console.WriteLine(min);
        }

       static bool check(int x,int k)
        {
            int sum = 0;
            for(var i = 0; i < k; i++)
            {
                sum = x / k;
            }
            return sum == k;
        }

    }
}
0