結果

問題 No.886 Direct
ユーザー k-kk-k
提出日時 2019-09-21 18:20:14
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 42,564 KB
最終ジャッジ日時 2023-10-19 06:41:26
合計ジャッジ時間 9,902 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 507 ms
42,564 KB
testcase_01 AC 508 ms
42,524 KB
testcase_02 AC 501 ms
42,524 KB
testcase_03 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

MOD = 10 ** 9 + 7
if __name__ == "__main__":
    H, W = map(int, input().split(" "))
    field = np.zeros((H, W))
    ret = 0
    for h in range(1, H):
        for w in range(1, W):
            if field[h][w] == 0:
                ret += (H - h) * (W - w) * 2
                ret %= MOD
                i = 1
                while h * i < H and w * i < W:
                    field[h * i][w * i] = 1
                    i += 1

    ret += (H - 1) * W + H * (W - 1)
    ret %= MOD
    print(ret)
0