結果

問題 No.1274 楽しい格子点
ユーザー nagiss
提出日時 2020-10-30 23:49:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 104,336 KB
最終ジャッジ日時 2024-07-22 03:35:02
合計ジャッジ時間 15,636 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 38 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
A, B = map(int, input().split())
Closed = {(1, 1)}
ans = 0.25
Dx = [A,A,-A,-A,B,B,-B,-B]
Dy = [B,-B,B,B,A,-A,A,-A]
q = deque([(1, 1)])
for i in range(10**5):
    if not q:
        break
    x, y = q.popleft()
    for dx, dy in zip(Dx, Dy):
        ux, uy = x+dx, y+dy
        if (ux, uy) not in Closed:
            Closed.add((ux, uy))
            q.append((ux, uy))
            if 1 <= ux < 50 and 1 <= uy < 50:
                ans += 1 / ((ux+uy)**(ux+uy))
                #print(ux, uy)
print(ans)
0