結果

問題 No.864 四方演算
ユーザー kumatan400kumatan400
提出日時 2023-02-02 02:05:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 92 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 76,260 KB
最終ジャッジ日時 2023-09-14 11:30:22
合計ジャッジ時間 5,252 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,420 KB
testcase_01 AC 92 ms
75,312 KB
testcase_02 AC 90 ms
75,496 KB
testcase_03 AC 82 ms
75,488 KB
testcase_04 AC 87 ms
75,332 KB
testcase_05 AC 80 ms
75,480 KB
testcase_06 AC 85 ms
75,180 KB
testcase_07 AC 84 ms
75,500 KB
testcase_08 AC 86 ms
75,228 KB
testcase_09 AC 81 ms
75,184 KB
testcase_10 AC 80 ms
75,328 KB
testcase_11 AC 77 ms
75,316 KB
testcase_12 AC 85 ms
75,676 KB
testcase_13 AC 80 ms
75,340 KB
testcase_14 AC 75 ms
75,384 KB
testcase_15 AC 89 ms
75,408 KB
testcase_16 AC 84 ms
75,312 KB
testcase_17 AC 87 ms
75,368 KB
testcase_18 AC 91 ms
76,260 KB
testcase_19 AC 84 ms
75,228 KB
testcase_20 AC 87 ms
75,424 KB
testcase_21 AC 86 ms
75,316 KB
testcase_22 AC 84 ms
75,552 KB
testcase_23 AC 74 ms
75,264 KB
testcase_24 AC 83 ms
75,440 KB
testcase_25 AC 78 ms
75,316 KB
testcase_26 AC 84 ms
75,396 KB
testcase_27 AC 71 ms
71,440 KB
testcase_28 AC 71 ms
71,412 KB
testcase_29 AC 69 ms
71,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []
    i = 1
    while i * i <= n:
        if n % i == 0:
            divisors.append(i)
            j = n // i
            if i != j:
                divisors.append(j)
        i += 1
    return divisors


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

ans = 0
for s in make_divisors(K):
    a = min(s-1, N)
    b = max(1, s - N)
    n1 = max(0, a-b+1)
    
    t = K // s
    a = min(t-1, N)
    b = max(1, t - N)
    n2 = max(0, a-b+1)
    ans += n1 * n2
    

print(ans)
0