結果

問題 No.864 四方演算
ユーザー kumatan400kumatan400
提出日時 2022-12-06 13:54:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 463 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 60,988 KB
最終ジャッジ日時 2024-04-21 06:22:39
合計ジャッジ時間 2,933 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,932 KB
testcase_01 AC 58 ms
59,716 KB
testcase_02 AC 52 ms
57,456 KB
testcase_03 AC 52 ms
59,152 KB
testcase_04 AC 53 ms
57,812 KB
testcase_05 AC 50 ms
57,852 KB
testcase_06 AC 54 ms
57,680 KB
testcase_07 AC 54 ms
59,180 KB
testcase_08 AC 52 ms
57,128 KB
testcase_09 AC 48 ms
58,076 KB
testcase_10 AC 48 ms
58,164 KB
testcase_11 AC 48 ms
59,108 KB
testcase_12 AC 51 ms
58,616 KB
testcase_13 AC 48 ms
58,392 KB
testcase_14 AC 44 ms
58,848 KB
testcase_15 AC 58 ms
57,392 KB
testcase_16 AC 54 ms
58,376 KB
testcase_17 AC 57 ms
58,112 KB
testcase_18 AC 59 ms
60,988 KB
testcase_19 AC 53 ms
57,536 KB
testcase_20 AC 57 ms
58,272 KB
testcase_21 AC 56 ms
57,876 KB
testcase_22 AC 54 ms
58,484 KB
testcase_23 AC 47 ms
59,068 KB
testcase_24 AC 56 ms
58,008 KB
testcase_25 AC 49 ms
58,776 KB
testcase_26 AC 54 ms
58,100 KB
testcase_27 AC 41 ms
54,096 KB
testcase_28 AC 40 ms
52,700 KB
testcase_29 AC 38 ms
53,020 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(x):
    if x-1 <= N:
        return max(0, x-1)
    else:
        return max(0, N- (x-N) + 1)

ans = 0
for i in make_divisors(K):
    j = K // i
    ans += f(i) * f(j)

print(ans)
0