package main import ( "bufio" "fmt" "os" ) var sc = bufio.NewScanner(os.Stdin) // 任意の要素数の文字列を読み込んでスライスで返す func scanStrings(len int) (strings []string) { var str string for i := 0; i < len; i++ { fmt.Scanf("%s", &str) strings = append(strings, str) } return } // 任意の要素数の配列を読み込んでスライスで返す func scanNums(len int) (nums []int) { var num int for i := 0; i < len; i++ { fmt.Scan(&num) nums = append(nums, num) } return } func reverse(s string) string { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } return string(runes) } func flag(mid float64, k int, ll []int) bool { sum := 0 for _, v := range ll { sum += int(float64(v) / mid) } // fmt.Println("sum:", sum) if sum >= k { return true } return false } func main() { n := scanNums(1)[0] ll := scanNums(n) k := scanNums(1)[0] l := 0.0 r := 1e10 for i := 0; i < 100 && r-l > 1e-10; i++ { mid := (r + l) / 2.0 if flag(mid, k, ll) { l = mid // fmt.Println("true mid:", mid) } else { r = mid } } // fmt.Println("n,l,k,ll", n, l, k, ll) fmt.Printf("%f\n", l) }