結果

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

ソースコード

diff #

from decimal import Decimal
import decimal
import sys
import math
a,b=map(int,input().split())
decimal.getcontext().prec = 400
if a==0 and b==0:
    print("0.25")
    sys.exit()
k=math.gcd(a,b)
ans=Decimal(0)
for i in range(1,100):
    for j in range(1,100):
        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