結果

問題 No.1274 楽しい格子点
ユーザー realDivineJKrealDivineJK
提出日時 2020-10-30 23:55:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,018 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 17,192 KB
最終ジャッジ日時 2023-09-29 09:02:34
合計ジャッジ時間 6,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B = map(int, input().split())
A = abs(A)
B = abs(B)
if A == 0 or B == 0:
    if A == 0 and B == 0:
        print(0.25)
    else:
        m = max(A, B)
        S = 1/4
        for i in range(102, 2, -1):
            if (i - 1) % m == 0:
                S += ((i - 1) // m + 1) / pow(i, i)
        print(S)
else:
    S = 0
    L = [[0 for _ in range(101)] for __ in range(101)]
    F = [0 for _ in range(101)]
    for i in range(-30, 30):
        for j in range(-30, 30):
            for k in range(-30, 30):
                for l in range(-30, 30):
                    if i % 2 == l % 2 and j % 2 == k % 2:
                        p = 1 + i * A + j * B
                        q = 1 + k * A + l * B
                        if 0 < p < 100 and 0 < q < 100 and p + q < 100:
                            L[p][q] = 1
    for i in range(100, 0, -1):
        for j in range(100, 0, -1):
            if i + j <= 100:
                F[i+j] += L[i][j]
    for i in range(100, 1, -1):
        S += F[i] / pow(i, i)
    print(S)
0