結果

問題 No.1274 楽しい格子点
ユーザー gew1fw
提出日時 2025-06-12 18:43:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 71,976 KB
最終ジャッジ日時 2025-06-12 18:43:53
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 50 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

if A == 0 and B == 0:
    print("{0:.12f}".format(0.25))
else:
    d = math.gcd(abs(A), abs(B))
    sum_total = 0.0
    n = 0
    while True:
        denominator = d * n + 2
        exponent = denominator
        term = (n + 1) / (denominator ** exponent)
        if term < 1e-20:  # Stop when term becomes negligible
            break
        sum_total += term
        n += 1
    # Ensure sufficient precision in output
    print("{0:.12f}".format(sum_total))
0