結果

問題 No.864 四方演算
ユーザー kumatan400kumatan400
提出日時 2022-09-10 14:55:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 1,000 ms
コード長 438 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 76,112 KB
最終ジャッジ日時 2023-08-17 19:11:37
合計ジャッジ時間 4,516 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,168 KB
testcase_01 AC 95 ms
75,228 KB
testcase_02 AC 90 ms
75,416 KB
testcase_03 AC 94 ms
75,180 KB
testcase_04 AC 93 ms
75,416 KB
testcase_05 AC 91 ms
75,060 KB
testcase_06 AC 93 ms
75,060 KB
testcase_07 AC 93 ms
75,544 KB
testcase_08 AC 93 ms
75,328 KB
testcase_09 AC 87 ms
75,176 KB
testcase_10 AC 87 ms
75,736 KB
testcase_11 AC 82 ms
75,332 KB
testcase_12 AC 91 ms
75,348 KB
testcase_13 AC 86 ms
75,056 KB
testcase_14 AC 83 ms
75,488 KB
testcase_15 AC 94 ms
75,144 KB
testcase_16 AC 92 ms
75,236 KB
testcase_17 AC 94 ms
75,480 KB
testcase_18 AC 96 ms
76,112 KB
testcase_19 AC 86 ms
75,288 KB
testcase_20 AC 91 ms
75,416 KB
testcase_21 AC 93 ms
75,172 KB
testcase_22 AC 92 ms
75,248 KB
testcase_23 AC 83 ms
75,308 KB
testcase_24 AC 88 ms
75,424 KB
testcase_25 AC 84 ms
75,080 KB
testcase_26 AC 91 ms
75,452 KB
testcase_27 AC 77 ms
71,360 KB
testcase_28 AC 78 ms
71,416 KB
testcase_29 AC 79 ms
71,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

ans = 0
for d in make_divisors(K):
    t = K // d

    a = max(0, d-1 - max(0, d-1 - N)*2)
    b = max(0, t-1 - max(0, t-1 - N)*2)

    ans += a * b

print(ans)
0