結果

問題 No.864 四方演算
ユーザー kumatan400kumatan400
提出日時 2023-02-22 11:29:47
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 92 ms / 1,000 ms
コード長 470 bytes
コンパイル時間 628 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 76,188 KB
最終ジャッジ日時 2023-09-29 19:55:34
合計ジャッジ時間 5,305 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,132 KB
testcase_01 AC 90 ms
75,328 KB
testcase_02 AC 86 ms
75,224 KB
testcase_03 AC 84 ms
75,604 KB
testcase_04 AC 89 ms
75,220 KB
testcase_05 AC 86 ms
75,236 KB
testcase_06 AC 90 ms
75,320 KB
testcase_07 AC 91 ms
75,328 KB
testcase_08 AC 86 ms
75,388 KB
testcase_09 AC 81 ms
75,316 KB
testcase_10 AC 81 ms
75,228 KB
testcase_11 AC 76 ms
75,324 KB
testcase_12 AC 84 ms
75,172 KB
testcase_13 AC 80 ms
75,416 KB
testcase_14 AC 75 ms
75,488 KB
testcase_15 AC 89 ms
75,328 KB
testcase_16 AC 85 ms
75,456 KB
testcase_17 AC 87 ms
75,444 KB
testcase_18 AC 92 ms
76,188 KB
testcase_19 AC 83 ms
75,320 KB
testcase_20 AC 88 ms
75,368 KB
testcase_21 AC 87 ms
75,080 KB
testcase_22 AC 85 ms
75,376 KB
testcase_23 AC 73 ms
75,332 KB
testcase_24 AC 83 ms
75,468 KB
testcase_25 AC 79 ms
75,416 KB
testcase_26 AC 89 ms
75,172 KB
testcase_27 AC 75 ms
71,428 KB
testcase_28 AC 73 ms
71,308 KB
testcase_29 AC 73 ms
71,148 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())

def f(N, i):
    t = min(N, i-1)
    s = max(1, i-t)
    res = max(0, t-s+1)
    return res
    
ans = 0
for i in make_divisors(K):
    j = K // i
    
    ans += f(N, i) * f(N, j)

print(ans)
0