結果

問題 No.864 四方演算
ユーザー rlangevinrlangevin
提出日時 2023-01-15 01:16:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 1,000 ms
コード長 402 bytes
コンパイル時間 1,616 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 76,080 KB
最終ジャッジ日時 2023-08-27 05:19:56
合計ジャッジ時間 5,277 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,184 KB
testcase_01 AC 94 ms
75,340 KB
testcase_02 AC 87 ms
75,360 KB
testcase_03 AC 87 ms
75,332 KB
testcase_04 AC 89 ms
75,304 KB
testcase_05 AC 86 ms
75,332 KB
testcase_06 AC 88 ms
75,428 KB
testcase_07 AC 86 ms
75,408 KB
testcase_08 AC 86 ms
75,472 KB
testcase_09 AC 82 ms
75,336 KB
testcase_10 AC 82 ms
75,404 KB
testcase_11 AC 77 ms
75,376 KB
testcase_12 AC 86 ms
75,376 KB
testcase_13 AC 83 ms
75,468 KB
testcase_14 AC 80 ms
75,428 KB
testcase_15 AC 92 ms
75,408 KB
testcase_16 AC 86 ms
75,332 KB
testcase_17 AC 90 ms
75,092 KB
testcase_18 AC 111 ms
76,080 KB
testcase_19 AC 85 ms
75,340 KB
testcase_20 AC 91 ms
75,092 KB
testcase_21 AC 89 ms
75,332 KB
testcase_22 AC 85 ms
75,508 KB
testcase_23 AC 76 ms
75,364 KB
testcase_24 AC 85 ms
75,428 KB
testcase_25 AC 79 ms
75,388 KB
testcase_26 AC 87 ms
75,332 KB
testcase_27 AC 71 ms
71,352 KB
testcase_28 AC 71 ms
71,176 KB
testcase_29 AC 72 ms
71,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(n):
    if n <= 0:
        return []
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    return list(S)

def f(n, d):
    return max(0, min(n, d - 1) - max(1, d - n) + 1)

N = int(input())
K = int(input())

ans = 0
for d in div(K):
    ans += f(N, d) * f(N, K//d)
    # print(d, f(N, d) * f(N, K//d))
print(ans)
0