結果

問題 No.1274 楽しい格子点
コンテスト
ユーザー hotman78
提出日時 2020-09-24 22:53:35
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 551 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 152 ms
コンパイル使用メモリ 85,760 KB
実行使用メモリ 86,644 KB
最終ジャッジ日時 2026-03-16 16:47:50
合計ジャッジ時間 9,468 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other AC * 15 WA * 15 RE * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from decimal import Decimal
import decimal
import sys
import math
a,b=map(int,input().split())
decimal.getcontext().prec = 10000
if a==0 and b==0:
    print("0.25")
    sys.exit()
ans=Decimal(0)
for i in range(1,100):
    for j in range(1,100):
        k=math.gcd(a,b)
        if(a!=b and i%k==1 and j%k==1):
            if (i/k+j/k)%2==0 or (a/k+b/k)%2==1:
                ans+=Decimal(1)/Decimal((i+j)**(i+j))
        if a!=b and k==1:
            if (i/k+j/k)%2==0 or (a/k+b/k)%2==1:
                ans+=Decimal(1)/Decimal((i+j)**(i+j))
print(ans)
0