結果

問題 No.1274 楽しい格子点
ユーザー hotman78
提出日時 2020-09-24 22:53:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 82,432 KB
最終ジャッジ日時 2024-06-28 05:31:50
合計ジャッジ時間 19,705 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other AC * 15 WA * 15 RE * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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