結果

問題 No.1274 楽しい格子点
ユーザー nagissnagiss
提出日時 2020-10-30 23:59:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 25,396 KB
最終ジャッジ日時 2023-09-29 09:04:46
合計ジャッジ時間 33,217 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 521 ms
23,288 KB
testcase_02 WA -
testcase_03 AC 528 ms
24,744 KB
testcase_04 WA -
testcase_05 AC 515 ms
21,916 KB
testcase_06 WA -
testcase_07 AC 532 ms
22,676 KB
testcase_08 AC 548 ms
25,328 KB
testcase_09 AC 517 ms
21,908 KB
testcase_10 AC 524 ms
21,860 KB
testcase_11 WA -
testcase_12 AC 520 ms
22,048 KB
testcase_13 AC 518 ms
22,072 KB
testcase_14 WA -
testcase_15 AC 517 ms
22,516 KB
testcase_16 AC 520 ms
21,836 KB
testcase_17 AC 521 ms
21,988 KB
testcase_18 AC 514 ms
22,040 KB
testcase_19 AC 507 ms
21,840 KB
testcase_20 AC 516 ms
21,904 KB
testcase_21 AC 510 ms
22,592 KB
testcase_22 AC 536 ms
25,368 KB
testcase_23 AC 542 ms
25,292 KB
testcase_24 AC 540 ms
25,384 KB
testcase_25 AC 538 ms
25,212 KB
testcase_26 AC 551 ms
25,220 KB
testcase_27 AC 541 ms
25,288 KB
testcase_28 AC 554 ms
25,312 KB
testcase_29 AC 546 ms
25,324 KB
testcase_30 AC 540 ms
25,212 KB
testcase_31 AC 550 ms
25,064 KB
testcase_32 AC 537 ms
25,252 KB
testcase_33 AC 545 ms
25,396 KB
testcase_34 AC 544 ms
25,204 KB
testcase_35 AC 545 ms
25,328 KB
testcase_36 AC 559 ms
25,256 KB
testcase_37 AC 537 ms
25,260 KB
testcase_38 AC 544 ms
25,264 KB
testcase_39 AC 544 ms
25,340 KB
testcase_40 AC 554 ms
25,256 KB
testcase_41 AC 548 ms
25,272 KB
testcase_42 AC 531 ms
24,220 KB
testcase_43 AC 526 ms
24,432 KB
testcase_44 AC 542 ms
24,632 KB
testcase_45 AC 531 ms
24,552 KB
testcase_46 AC 532 ms
24,540 KB
testcase_47 AC 534 ms
24,948 KB
testcase_48 AC 539 ms
24,612 KB
testcase_49 AC 538 ms
22,548 KB
testcase_50 AC 528 ms
24,544 KB
testcase_51 AC 545 ms
24,864 KB
testcase_52 AC 19 ms
8,584 KB
testcase_53 AC 520 ms
23,724 KB
testcase_54 AC 550 ms
24,512 KB
testcase_55 AC 524 ms
21,904 KB
testcase_56 WA -
testcase_57 AC 539 ms
25,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import deque
A, B = map(int, input().split())
A, B = gcd(A, B), 0
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