結果

問題 No.864 四方演算
ユーザー hirakuhiraku
提出日時 2021-06-02 21:17:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 532 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-27 14:20:46
合計ジャッジ時間 3,451 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,880 KB
testcase_01 AC 127 ms
10,880 KB
testcase_02 AC 94 ms
10,624 KB
testcase_03 AC 98 ms
10,752 KB
testcase_04 AC 110 ms
10,624 KB
testcase_05 AC 84 ms
10,880 KB
testcase_06 AC 112 ms
10,752 KB
testcase_07 AC 99 ms
10,624 KB
testcase_08 AC 90 ms
10,752 KB
testcase_09 AC 65 ms
10,752 KB
testcase_10 AC 59 ms
11,008 KB
testcase_11 AC 42 ms
10,880 KB
testcase_12 AC 92 ms
10,624 KB
testcase_13 AC 73 ms
10,752 KB
testcase_14 AC 43 ms
10,624 KB
testcase_15 AC 120 ms
10,752 KB
testcase_16 AC 97 ms
10,880 KB
testcase_17 AC 107 ms
10,880 KB
testcase_18 AC 97 ms
10,752 KB
testcase_19 AC 79 ms
10,880 KB
testcase_20 AC 117 ms
10,624 KB
testcase_21 AC 100 ms
10,624 KB
testcase_22 AC 89 ms
10,624 KB
testcase_23 AC 34 ms
10,880 KB
testcase_24 AC 83 ms
10,624 KB
testcase_25 AC 57 ms
10,752 KB
testcase_26 AC 89 ms
10,752 KB
testcase_27 AC 26 ms
10,624 KB
testcase_28 AC 27 ms
10,624 KB
testcase_29 AC 27 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 約数列挙
def make_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n ** .5) + 1):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)

    upper_divisors.reverse()
    return lower_divisors + upper_divisors


n = int(input())
k = int(input())

li = make_divisors(k)

ans = 0
for m in li:
    p = k // m
    ans += min(m - 1, max(2 * n - m + 1, 0)) * \
        min(p - 1, max(2 * n - p + 1, 0))

print(ans)
0