結果

問題 No.864 四方演算
ユーザー kumatan400kumatan400
提出日時 2021-12-29 13:07:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 1,000 ms
コード長 412 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 60,696 KB
最終ジャッジ日時 2024-04-14 18:41:54
合計ジャッジ時間 2,701 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,828 KB
testcase_01 AC 55 ms
58,444 KB
testcase_02 AC 48 ms
58,516 KB
testcase_03 AC 49 ms
59,520 KB
testcase_04 AC 51 ms
57,520 KB
testcase_05 AC 47 ms
58,060 KB
testcase_06 AC 51 ms
57,916 KB
testcase_07 AC 50 ms
58,140 KB
testcase_08 AC 48 ms
57,516 KB
testcase_09 AC 44 ms
57,512 KB
testcase_10 AC 43 ms
58,500 KB
testcase_11 AC 43 ms
58,712 KB
testcase_12 AC 50 ms
59,120 KB
testcase_13 AC 48 ms
58,640 KB
testcase_14 AC 42 ms
57,452 KB
testcase_15 AC 53 ms
57,756 KB
testcase_16 AC 49 ms
58,240 KB
testcase_17 AC 51 ms
58,772 KB
testcase_18 AC 55 ms
60,696 KB
testcase_19 AC 48 ms
58,928 KB
testcase_20 AC 53 ms
58,708 KB
testcase_21 AC 50 ms
59,440 KB
testcase_22 AC 49 ms
58,388 KB
testcase_23 AC 41 ms
57,516 KB
testcase_24 AC 47 ms
59,304 KB
testcase_25 AC 43 ms
58,980 KB
testcase_26 AC 49 ms
58,308 KB
testcase_27 AC 36 ms
52,348 KB
testcase_28 AC 37 ms
53,308 KB
testcase_29 AC 37 ms
53,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors

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

def cnt(R):
    return min(R-1, max(0, R-1 - (R-1-N)*2))

D = make_divisors(K)
ans = 0
for d in D:
    r = K // d
    ans += cnt(d) * cnt(r)
print(ans)
0