結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー Yuuki77
提出日時 2018-01-07 16:21:49
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 942 bytes
コンパイル時間 5,034 ms
コンパイル使用メモリ 114,008 KB
実行使用メモリ 52,556 KB
最終ジャッジ日時 2025-03-03 11:06:50
合計ジャッジ時間 10,342 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 1 RE * 5 TLE * 1 -- * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
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