結果
| 問題 |
No.1042 愚直大学
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-05-01 22:35:14 |
| 言語 | Go (1.23.4) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 805 bytes |
| コンパイル時間 | 18,148 ms |
| コンパイル使用メモリ | 224,344 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-25 13:20:23 |
| 合計ジャッジ時間 | 35,350 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 TLE * 8 |
ソースコード
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.0
ng := float64(math.MaxInt64)
for ng-ok > 0.0000001 {
m := ok + (ng-ok)/2
if isOk(float64(m)) {
ok = m
} else {
ng = m
}
}
fmt.Println(ok)
}
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
}
c-yan