結果
| 問題 |
No.1274 楽しい格子点
|
| コンテスト | |
| ユーザー |
hotman78
|
| 提出日時 | 2020-09-24 22:55:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 548 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 89,216 KB |
| 最終ジャッジ日時 | 2024-06-28 05:32:17 |
| 合計ジャッジ時間 | 5,371 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 1 TLE * 1 -- * 55 |
ソースコード
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()
ans=Decimal(0)
for i in range(1,300):
for j in range(1,300):
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)
hotman78