結果
問題 | No.1042 愚直大学 |
ユーザー |
![]() |
提出日時 | 2020-05-01 22:11:37 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 4,393 ms |
コンパイル使用メモリ | 64,880 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 11:39:50 |
合計ジャッジ時間 | 5,257 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
import math, strutils let read* = iterator: string = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() let P, Q = input(float) proc f(N: float): float = N * N - Q * N * log2(N) - P var ok = 1.0 var ng = 1e20 for _ in 1 .. 100000: var mid = (ok + ng) / 2.0 if f(mid) <= 0.0: ok = mid else: ng = mid echo ok.formatFloat(ffDecimal, 10)