結果

問題 No.864 四方演算
ユーザー 👑 rin204rin204
提出日時 2022-02-14 09:19:20
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 89 ms / 1,000 ms
コード長 396 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 76,348 KB
最終ジャッジ日時 2023-09-11 15:49:25
合計ジャッジ時間 4,816 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,652 KB
testcase_01 AC 89 ms
76,336 KB
testcase_02 AC 80 ms
75,916 KB
testcase_03 AC 83 ms
75,792 KB
testcase_04 AC 83 ms
75,712 KB
testcase_05 AC 81 ms
76,028 KB
testcase_06 AC 84 ms
75,924 KB
testcase_07 AC 83 ms
76,284 KB
testcase_08 AC 83 ms
75,928 KB
testcase_09 AC 80 ms
75,940 KB
testcase_10 AC 77 ms
76,244 KB
testcase_11 AC 74 ms
76,036 KB
testcase_12 AC 80 ms
75,888 KB
testcase_13 AC 78 ms
75,828 KB
testcase_14 AC 73 ms
75,916 KB
testcase_15 AC 84 ms
76,028 KB
testcase_16 AC 80 ms
76,136 KB
testcase_17 AC 81 ms
76,036 KB
testcase_18 AC 82 ms
75,916 KB
testcase_19 AC 79 ms
76,348 KB
testcase_20 AC 83 ms
75,892 KB
testcase_21 AC 81 ms
75,844 KB
testcase_22 AC 79 ms
75,852 KB
testcase_23 AC 72 ms
75,832 KB
testcase_24 AC 77 ms
75,924 KB
testcase_25 AC 75 ms
75,940 KB
testcase_26 AC 78 ms
75,840 KB
testcase_27 AC 66 ms
71,752 KB
testcase_28 AC 68 ms
71,564 KB
testcase_29 AC 67 ms
71,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
k = int(input())
ans = 0

def f(x):
    if x <= 1:
        return 0
    elif x <= n + 1:
        return x - 1
    elif x <= 2 * n:
        return 2 * n + 1 - x
    else:
        return 0
    

for i in range(1, int(k ** 0.5 + 1)):
    if k % i == 0:
        tmp = f(i) * f(k // i)
        if i == k // i:
            ans += tmp
        else:
            ans += 2 * tmp
print(ans)
0