結果

問題 No.1274 楽しい格子点
ユーザー nagissnagiss
提出日時 2020-10-31 00:01:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 585 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 49,492 KB
最終ジャッジ日時 2023-09-29 09:08:54
合計ジャッジ時間 52,414 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 661 ms
23,692 KB
testcase_02 WA -
testcase_03 AC 912 ms
49,032 KB
testcase_04 WA -
testcase_05 AC 915 ms
49,256 KB
testcase_06 WA -
testcase_07 AC 935 ms
49,372 KB
testcase_08 AC 945 ms
49,436 KB
testcase_09 AC 914 ms
49,412 KB
testcase_10 AC 907 ms
49,336 KB
testcase_11 WA -
testcase_12 AC 893 ms
49,200 KB
testcase_13 AC 906 ms
49,476 KB
testcase_14 WA -
testcase_15 AC 931 ms
49,400 KB
testcase_16 AC 896 ms
49,012 KB
testcase_17 AC 921 ms
49,268 KB
testcase_18 AC 894 ms
49,492 KB
testcase_19 AC 899 ms
48,840 KB
testcase_20 AC 880 ms
48,288 KB
testcase_21 AC 903 ms
49,384 KB
testcase_22 AC 907 ms
48,492 KB
testcase_23 AC 907 ms
48,360 KB
testcase_24 AC 877 ms
48,504 KB
testcase_25 AC 896 ms
48,512 KB
testcase_26 AC 899 ms
48,548 KB
testcase_27 AC 890 ms
48,556 KB
testcase_28 AC 895 ms
48,396 KB
testcase_29 AC 885 ms
48,476 KB
testcase_30 AC 900 ms
48,552 KB
testcase_31 AC 893 ms
48,288 KB
testcase_32 AC 887 ms
48,544 KB
testcase_33 AC 929 ms
48,372 KB
testcase_34 AC 917 ms
48,376 KB
testcase_35 AC 903 ms
48,360 KB
testcase_36 AC 888 ms
48,568 KB
testcase_37 AC 912 ms
48,468 KB
testcase_38 AC 894 ms
48,360 KB
testcase_39 AC 926 ms
48,392 KB
testcase_40 AC 888 ms
48,472 KB
testcase_41 AC 936 ms
48,372 KB
testcase_42 AC 798 ms
45,156 KB
testcase_43 AC 859 ms
46,284 KB
testcase_44 AC 830 ms
45,356 KB
testcase_45 AC 808 ms
45,304 KB
testcase_46 AC 806 ms
45,256 KB
testcase_47 AC 858 ms
45,568 KB
testcase_48 AC 864 ms
46,676 KB
testcase_49 AC 835 ms
45,216 KB
testcase_50 AC 878 ms
47,808 KB
testcase_51 AC 906 ms
47,200 KB
testcase_52 AC 18 ms
8,560 KB
testcase_53 AC 693 ms
23,660 KB
testcase_54 AC 716 ms
24,584 KB
testcase_55 AC 669 ms
21,840 KB
testcase_56 WA -
testcase_57 AC 745 ms
25,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import deque
A, B = map(int, input().split())
G = gcd(A, B)
Closed = {(1, 1)}
ans = 0.25
Dx = [G,0,-G,0,A,A,-A,-A,B,B,-B,-B]
Dy = [0,G,0,-G,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 < 20 and 1 <= uy < 20:
                ans += 1 / ((ux+uy)**(ux+uy))
                #print(ux, uy)
print(ans)
0