結果
問題 | No.1305 Speak of the Devil |
ユーザー | 👑Zack Ni |
提出日時 | 2020-12-02 04:32:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 87,164 KB |
実行使用メモリ | 94,360 KB |
最終ジャッジ日時 | 2023-10-11 04:28:11 |
合計ジャッジ時間 | 10,434 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 254 ms
88,872 KB |
testcase_13 | AC | 251 ms
88,328 KB |
testcase_14 | AC | 253 ms
88,640 KB |
testcase_15 | AC | 256 ms
88,396 KB |
testcase_16 | AC | 255 ms
88,744 KB |
testcase_17 | AC | 258 ms
88,976 KB |
testcase_18 | AC | 260 ms
89,004 KB |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
import sys import argparse def main(): p, q = list(map(int,input().split())) p = float(p) q = float(q) w = pow(p, -1) t = pow(p, -1) x = p*p y = (p-1) ans = 0 prevans = -1000 i = 0 while True: ans = w * (x - p * y - i*y ) w = w * t x = x * p y = y * (p-1) i = i + 1 if ans - prevans < 1e-3: break prevans = ans print(min(ans, q)) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--file', dest='filename', default=None) args = parser.parse_args() if args.filename is not None: sys.stdin = open(args.filename) main()