結果

問題 No.886 Direct
ユーザー hattori_trickhattori_trick
提出日時 2019-09-20 18:12:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 741 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 12,680 KB
最終ジャッジ日時 2023-10-12 10:49:37
合計ジャッジ時間 6,161 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
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 #

def gojohou(a, b):
    x1, x2 = int(a), int(b)
    if x1 < x2:
        tmp = x1
        x1 = x2
        x2 = tmp
    if x2 == 0:
        return x1
    while x2 != 0:
        tmp = x2
        x2 = x1 % x2
        x1 = tmp
    return x1


def naname(wid, hei):
    if gojohou(wid, hei) == 1:
        if (wid == 0)or(hei == 0):
            return 1
        else:
            return 2
    return 0


def count(WMAX, HMAX):
    ans = 0
    for a in range(WMAX):
        for b in range(HMAX):
            x = WMAX - a
            y = HMAX - b
            ans += naname(a, b) * x * y
    return ans


while True:
    xy = input().split()
    z = count(int(xy[0]), int(xy[1])) % (1000000000 + 7)
    print(z)
0