結果
| 問題 |
No.1305 Speak of the Devil
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-02 04:34:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 702 bytes |
| コンパイル時間 | 674 ms |
| コンパイル使用メモリ | 82,192 KB |
| 実行使用メモリ | 86,564 KB |
| 最終ジャッジ日時 | 2024-09-13 03:49:10 |
| 合計ジャッジ時間 | 5,927 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 12 TLE * 1 -- * 7 |
ソースコード
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-4:
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()