結果

問題 No.1274 楽しい格子点
ユーザー nagissnagiss
提出日時 2020-10-31 00:11:43
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 607 bytes
コンパイル時間 61 ms
使用メモリ 49,104 KB
最終ジャッジ日時 2023-02-22 17:17:12
合計ジャッジ時間 50,390 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 WA -
testcase_01 AC 644 ms
23,324 KB
testcase_02 AC 867 ms
48,232 KB
testcase_03 AC 886 ms
48,868 KB
testcase_04 AC 870 ms
48,868 KB
testcase_05 AC 868 ms
48,832 KB
testcase_06 AC 874 ms
48,280 KB
testcase_07 AC 880 ms
49,008 KB
testcase_08 AC 874 ms
48,872 KB
testcase_09 AC 869 ms
48,876 KB
testcase_10 AC 864 ms
48,840 KB
testcase_11 AC 879 ms
48,688 KB
testcase_12 AC 870 ms
48,792 KB
testcase_13 AC 886 ms
48,856 KB
testcase_14 AC 856 ms
48,220 KB
testcase_15 AC 878 ms
48,812 KB
testcase_16 AC 866 ms
48,280 KB
testcase_17 AC 861 ms
48,924 KB
testcase_18 AC 878 ms
48,968 KB
testcase_19 AC 867 ms
48,328 KB
testcase_20 AC 868 ms
47,968 KB
testcase_21 AC 882 ms
49,104 KB
testcase_22 AC 844 ms
47,956 KB
testcase_23 AC 861 ms
47,864 KB
testcase_24 AC 854 ms
47,988 KB
testcase_25 AC 851 ms
48,008 KB
testcase_26 AC 839 ms
47,988 KB
testcase_27 AC 867 ms
47,864 KB
testcase_28 AC 847 ms
48,060 KB
testcase_29 AC 863 ms
47,892 KB
testcase_30 AC 853 ms
47,900 KB
testcase_31 AC 850 ms
47,980 KB
testcase_32 AC 865 ms
47,952 KB
testcase_33 AC 857 ms
47,948 KB
testcase_34 AC 871 ms
47,984 KB
testcase_35 AC 865 ms
47,876 KB
testcase_36 AC 861 ms
48,032 KB
testcase_37 AC 850 ms
47,948 KB
testcase_38 AC 862 ms
47,852 KB
testcase_39 AC 866 ms
47,892 KB
testcase_40 AC 856 ms
48,024 KB
testcase_41 AC 857 ms
47,864 KB
testcase_42 AC 814 ms
44,780 KB
testcase_43 AC 847 ms
46,060 KB
testcase_44 AC 804 ms
44,740 KB
testcase_45 AC 823 ms
44,716 KB
testcase_46 AC 797 ms
44,956 KB
testcase_47 AC 816 ms
45,328 KB
testcase_48 AC 844 ms
46,212 KB
testcase_49 AC 802 ms
44,756 KB
testcase_50 AC 865 ms
47,200 KB
testcase_51 AC 849 ms
46,820 KB
testcase_52 AC 19 ms
8,180 KB
testcase_53 AC 631 ms
23,356 KB
testcase_54 AC 658 ms
23,960 KB
testcase_55 AC 626 ms
21,732 KB
testcase_56 AC 626 ms
21,804 KB
testcase_57 AC 654 ms
24,808 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:
                if not (A+B&1 == 0 and ux+uy&1):
                    ans += 1 / ((ux+uy)**(ux+uy))
print(ans)
0