結果

問題 No.1274 楽しい格子点
ユーザー lam6er
提出日時 2025-04-16 00:17:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 71,760 KB
最終ジャッジ日時 2025-04-16 00:19:44
合計ジャッジ時間 3,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 50 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

A, B = map(int, input().split())

a = abs(A)
b = abs(B)
d = math.gcd(a, b) if a != 0 or b != 0 else 0

if d == 0:
    print("{0:.12f}".format(0.25))
else:
    total = 0.0
    n = 0
    while True:
        s = 2 + d * n
        term = (n + 1) / (s ** s)
        if term < 1e-20:  # Break when term is negligible for precision
            break
        total += term
        n += 1
    # Ensure the output has enough decimal places
    print("{0:.12f}".format(total))
0