結果
問題 |
No.1042 愚直大学
|
ユーザー |
![]() |
提出日時 | 2020-05-01 22:33:04 |
言語 | Go (1.23.4) |
結果 |
TLE
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 10,601 ms |
コンパイル使用メモリ | 217,716 KB |
実行使用メモリ | 10,160 KB |
最終ジャッジ日時 | 2024-12-25 13:10:41 |
合計ジャッジ時間 | 17,773 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 TLE * 2 |
ソースコード
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { P := readInt() Q := readInt() isOk := func(N float64) bool { return N <= float64(Q)*math.Log2(N)+float64(P)/N } ok := 1 ng := math.MaxInt64 for ng-ok != 1 { m := ok + (ng-ok)/2 if isOk(float64(m)) { ok = m } else { ng = m } } t := float64(ok) e := 1 / math.Pow(2, 18) for isOk(t) { t += e } fmt.Println(t - e) } const ( ioBufferSize = 1 * 1024 * 1024 // 1 MB ) var stdinScanner = func() *bufio.Scanner { result := bufio.NewScanner(os.Stdin) result.Buffer(make([]byte, ioBufferSize), ioBufferSize) result.Split(bufio.ScanWords) return result }() func readString() string { stdinScanner.Scan() return stdinScanner.Text() } func readInt() int { result, err := strconv.Atoi(readString()) if err != nil { panic(err) } return result }