結果

問題 No.864 四方演算
ユーザー convexineqconvexineq
提出日時 2021-04-04 20:22:10
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 99 ms / 1,000 ms
コード長 515 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 75,956 KB
最終ジャッジ日時 2023-08-27 21:57:02
合計ジャッジ時間 4,615 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,028 KB
testcase_01 AC 91 ms
75,164 KB
testcase_02 AC 83 ms
75,256 KB
testcase_03 AC 85 ms
75,556 KB
testcase_04 AC 87 ms
75,288 KB
testcase_05 AC 82 ms
75,332 KB
testcase_06 AC 86 ms
75,368 KB
testcase_07 AC 84 ms
75,552 KB
testcase_08 AC 83 ms
75,320 KB
testcase_09 AC 77 ms
75,424 KB
testcase_10 AC 77 ms
75,432 KB
testcase_11 AC 74 ms
75,252 KB
testcase_12 AC 84 ms
75,292 KB
testcase_13 AC 80 ms
75,332 KB
testcase_14 AC 75 ms
75,560 KB
testcase_15 AC 87 ms
75,208 KB
testcase_16 AC 83 ms
75,464 KB
testcase_17 AC 85 ms
75,304 KB
testcase_18 AC 99 ms
75,956 KB
testcase_19 AC 82 ms
75,344 KB
testcase_20 AC 86 ms
75,496 KB
testcase_21 AC 85 ms
75,340 KB
testcase_22 AC 83 ms
75,224 KB
testcase_23 AC 74 ms
75,416 KB
testcase_24 AC 80 ms
75,360 KB
testcase_25 AC 77 ms
75,332 KB
testcase_26 AC 84 ms
75,216 KB
testcase_27 AC 69 ms
71,288 KB
testcase_28 AC 68 ms
71,292 KB
testcase_29 AC 69 ms
71,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_list(N): #約数のリスト
    if N == 1: return [1]
    res = []
    for i in range(1,N):
        if i*i >= N: break
        if N%i == 0:
            res.append(i)
            res.append(N//i)
    if i*i == N: res.append(i)
    return sorted(res)

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

def f(d,n):
    if d < 0: return 0
    r = (d+1)
    if d >= n:
        r -= 2*(d-n+1)
    if d >= 2*n:
        r += (d-2*n+1)
    return r

ans = 0
for d in divisor_list(k):
    ans += f(d-2,n)*f(k//d-2,n)
print(ans)
0