結果

問題 No.864 四方演算
ユーザー qibqib
提出日時 2023-01-05 12:40:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 1,000 ms
コード長 405 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 61,520 KB
最終ジャッジ日時 2024-11-29 02:03:11
合計ジャッジ時間 3,068 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,268 KB
testcase_01 AC 56 ms
59,004 KB
testcase_02 AC 52 ms
59,324 KB
testcase_03 AC 51 ms
58,516 KB
testcase_04 AC 53 ms
58,744 KB
testcase_05 AC 51 ms
58,196 KB
testcase_06 AC 53 ms
58,468 KB
testcase_07 AC 52 ms
58,524 KB
testcase_08 AC 51 ms
57,904 KB
testcase_09 AC 47 ms
57,908 KB
testcase_10 AC 47 ms
59,180 KB
testcase_11 AC 44 ms
58,704 KB
testcase_12 AC 53 ms
58,252 KB
testcase_13 AC 50 ms
58,732 KB
testcase_14 AC 45 ms
58,388 KB
testcase_15 AC 55 ms
58,560 KB
testcase_16 AC 52 ms
58,716 KB
testcase_17 AC 55 ms
59,072 KB
testcase_18 AC 57 ms
61,520 KB
testcase_19 AC 51 ms
59,316 KB
testcase_20 AC 55 ms
58,920 KB
testcase_21 AC 52 ms
58,140 KB
testcase_22 AC 52 ms
59,372 KB
testcase_23 AC 46 ms
58,532 KB
testcase_24 AC 51 ms
58,836 KB
testcase_25 AC 47 ms
59,444 KB
testcase_26 AC 53 ms
58,580 KB
testcase_27 AC 41 ms
52,872 KB
testcase_28 AC 40 ms
53,400 KB
testcase_29 AC 40 ms
52,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
k = int(input())

divs = set()
for x in range(1, int(math.sqrt(k)) + 1):
  if k % x == 0:
    divs.add(x)
    if x != k // x:
      divs.add(k // x)
  
ans = 0
for x in divs:
  y = k // x
  cnt = 1
  for d in [x, k // x]:
    if 2 <= d <= n + 1:
      cnt *= (d - 1)
    elif n + 2 <= d <= 2 * n:
      cnt *= (2 * n + 1 - d)
    else:
      cnt = 0

  ans += cnt

print(ans)
0