結果

問題 No.1274 楽しい格子点
ユーザー lam6er
提出日時 2025-03-20 20:46:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,708 KB
実行使用メモリ 67,480 KB
最終ジャッジ日時 2025-03-20 20:46:56
合計ジャッジ時間 6,354 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 45 WA * 6 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def main():
    import sys
    A, B = map(int, sys.stdin.readline().split())
    a = abs(A)
    b = abs(B)
    d = math.gcd(a, b)
    
    sum_total = 0.0
    s = 0
    while True:
        denominator_base = 2 + d * s
        exponent = denominator_base
        current_term = (s + 1) / (denominator_base ** exponent)
        if current_term < 1e-30:  # Break when terms are negligibly small
            break
        sum_total += current_term
        s += 1
    
    # Ensuring sufficient precision in output
    print("{0:.12f}".format(sum_total))

if __name__ == '__main__':
    main()
0