結果

問題 No.864 四方演算
ユーザー kumatankumatan
提出日時 2021-05-29 13:09:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 388 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2024-04-25 10:39:02
合計ジャッジ時間 3,125 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 56 ms
57,472 KB
testcase_02 AC 52 ms
57,472 KB
testcase_03 AC 52 ms
57,728 KB
testcase_04 AC 54 ms
57,856 KB
testcase_05 AC 53 ms
57,600 KB
testcase_06 AC 54 ms
57,856 KB
testcase_07 AC 54 ms
57,600 KB
testcase_08 AC 51 ms
57,728 KB
testcase_09 AC 49 ms
57,728 KB
testcase_10 AC 47 ms
57,856 KB
testcase_11 AC 45 ms
57,728 KB
testcase_12 AC 52 ms
57,600 KB
testcase_13 AC 49 ms
57,600 KB
testcase_14 AC 46 ms
57,856 KB
testcase_15 AC 56 ms
58,112 KB
testcase_16 AC 53 ms
58,112 KB
testcase_17 AC 55 ms
57,856 KB
testcase_18 AC 55 ms
58,240 KB
testcase_19 AC 52 ms
57,600 KB
testcase_20 AC 56 ms
57,728 KB
testcase_21 AC 53 ms
57,984 KB
testcase_22 AC 54 ms
58,240 KB
testcase_23 AC 46 ms
57,856 KB
testcase_24 AC 53 ms
57,728 KB
testcase_25 AC 48 ms
57,728 KB
testcase_26 AC 54 ms
57,984 KB
testcase_27 AC 40 ms
52,224 KB
testcase_28 AC 41 ms
52,224 KB
testcase_29 AC 41 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0
for i in range(1, int(K**0.5) + 1):
    if K%i == 0:
        j = K//i

        if N >= i-1:
            p = i-1
        else:
            p = max(0, -i+1+2*N)

        if N >= j-1:
            q = j-1
        else:
            q = max(0, -j+1+2*N)


        if i != j:
            ans += p*q * 2
        else:
            ans += p*q


print(ans)
0