結果

問題 No.864 四方演算
ユーザー convexineqconvexineq
提出日時 2021-04-04 20:19:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 86,636 KB
実行使用メモリ 75,612 KB
最終ジャッジ日時 2023-08-27 21:51:20
合計ジャッジ時間 5,155 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 92 ms
75,132 KB
testcase_03 AC 91 ms
75,148 KB
testcase_04 AC 95 ms
75,208 KB
testcase_05 AC 91 ms
75,552 KB
testcase_06 AC 95 ms
75,344 KB
testcase_07 AC 91 ms
75,072 KB
testcase_08 AC 89 ms
75,604 KB
testcase_09 AC 88 ms
75,212 KB
testcase_10 AC 85 ms
75,344 KB
testcase_11 AC 81 ms
75,236 KB
testcase_12 AC 88 ms
75,228 KB
testcase_13 AC 90 ms
75,332 KB
testcase_14 AC 83 ms
75,232 KB
testcase_15 AC 96 ms
75,212 KB
testcase_16 AC 89 ms
74,948 KB
testcase_17 AC 92 ms
75,144 KB
testcase_18 AC 91 ms
75,400 KB
testcase_19 AC 85 ms
75,144 KB
testcase_20 AC 91 ms
75,344 KB
testcase_21 AC 88 ms
75,228 KB
testcase_22 AC 89 ms
75,316 KB
testcase_23 AC 79 ms
75,408 KB
testcase_24 AC 87 ms
75,612 KB
testcase_25 AC 84 ms
75,240 KB
testcase_26 AC 87 ms
75,132 KB
testcase_27 AC 73 ms
71,096 KB
testcase_28 AC 73 ms
71,092 KB
testcase_29 AC 76 ms
71,128 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)
    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):
    r = f(d-2,n)*f(k//d-2,n)
    ans += 2*r if d*d != n else r
print(ans)
0