結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 817 ms
45,456 KB
testcase_01 AC 687 ms
23,708 KB
testcase_02 WA -
testcase_03 AC 890 ms
49,060 KB
testcase_04 WA -
testcase_05 AC 920 ms
49,352 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 914 ms
49,360 KB
testcase_09 AC 917 ms
49,268 KB
testcase_10 AC 901 ms
49,500 KB
testcase_11 WA -
testcase_12 AC 894 ms
49,280 KB
testcase_13 AC 904 ms
49,360 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 889 ms
48,944 KB
testcase_17 AC 907 ms
49,272 KB
testcase_18 AC 931 ms
49,384 KB
testcase_19 AC 902 ms
49,056 KB
testcase_20 AC 876 ms
48,388 KB
testcase_21 WA -
testcase_22 AC 918 ms
48,436 KB
testcase_23 AC 888 ms
48,464 KB
testcase_24 AC 883 ms
48,400 KB
testcase_25 AC 882 ms
48,420 KB
testcase_26 AC 868 ms
48,460 KB
testcase_27 AC 886 ms
48,396 KB
testcase_28 AC 908 ms
48,540 KB
testcase_29 AC 906 ms
48,516 KB
testcase_30 AC 877 ms
48,560 KB
testcase_31 AC 922 ms
48,460 KB
testcase_32 AC 901 ms
48,360 KB
testcase_33 AC 902 ms
48,432 KB
testcase_34 AC 874 ms
48,492 KB
testcase_35 AC 873 ms
48,436 KB
testcase_36 AC 897 ms
48,392 KB
testcase_37 AC 909 ms
48,468 KB
testcase_38 AC 878 ms
48,496 KB
testcase_39 AC 884 ms
48,532 KB
testcase_40 AC 883 ms
48,356 KB
testcase_41 AC 910 ms
48,528 KB
testcase_42 AC 829 ms
45,276 KB
testcase_43 AC 840 ms
46,212 KB
testcase_44 AC 834 ms
45,420 KB
testcase_45 AC 824 ms
45,320 KB
testcase_46 AC 801 ms
45,240 KB
testcase_47 AC 851 ms
45,788 KB
testcase_48 AC 855 ms
46,504 KB
testcase_49 WA -
testcase_50 AC 874 ms
47,764 KB
testcase_51 AC 882 ms
47,248 KB
testcase_52 AC 18 ms
8,616 KB
testcase_53 AC 688 ms
24,104 KB
testcase_54 AC 674 ms
24,408 KB
testcase_55 AC 670 ms
21,920 KB
testcase_56 AC 663 ms
22,448 KB
testcase_57 AC 729 ms
25,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import deque
A, B = map(int, input().split())
if A+B&1==0:
    G = gcd(A, B) * 2
else:
    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