#region ZIPPER using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; using System.Numerics; using sc = Scanner; class Program { static void Main(string[] args) { Solver solver = new Solver(); solver.Solve(); #if DEBUG System.Console.WriteLine("続行するには何かキーを押してください..."); System.Console.ReadKey(); #endif } } /// /// Java風のスキャナー,自作(某最速の人を参考) 自分の実装のせいか,バグってるっぽい バグが出たらO(n^3) n=100000 でTLE /// public static class Scanner { public static string NextString() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return tmp; } public static int NextInt() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return int.Parse(tmp); } public static long NextLong() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return long.Parse(tmp); } public static double NextDouble() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return double.Parse(tmp); } public static string[] NextStrArray() { return Console.ReadLine().Split(' '); } public static int[] NextIntArray() { string[] s = NextStrArray(); int[] a = new int[s.Length]; for (int i = 0; i < a.Length; i++) { a[i] = int.Parse(s[i]); } return a; } public static long[] NextLongArray() { string[] s = NextStrArray(); long[] a = new long[s.Length]; for (int i = 0; i < a.Length; i++) { a[i] = long.Parse(s[i]); } return a; } public static double[] NextDoubleArray() { string[] s = NextStrArray(); double[] a = new double[s.Length]; for (int i = 0; i < a.Length; i++) { a[i] = double.Parse(s[i]); } return a; } } #endregion ZIPPER public class Solver { #region IGNORE_ME public Solver() { //こんすとらくたん きにしなくてよろしい } #endregion IGNORE_ME #region FIELD #endregion FIELD public void Solve() { int n = sc.NextInt(); int[] l = sc.NextIntArray(); int k = sc.NextInt(); double eps = 1.0/1000000000000000; double low = 0; double mid = 0; double hi = 2 * 10000 + 1000; // seiyaku ni yoru max yori tyotto over while (hi - low > eps) { mid = (low + hi) / 2; if (canCut(l,mid,k)) { low = mid; } else { hi = mid; } } Console.WriteLine((low+hi)/2); #if DEBUG Console.WriteLine("");//local check #endif } /// ///ipponnatari s no nagasa de k hon kiretu /// /// /// /// bool canCut(int[] l,double s, int k) { int countOfCut = 0; for (int i = 0; i < l.Length; i++) { countOfCut += (int)(l[i]/s); } return countOfCut >= k ? true : false; } }