結果

問題 No.864 四方演算
ユーザー qibqib
提出日時 2023-01-05 12:40:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 405 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 76,236 KB
最終ジャッジ日時 2023-08-19 10:29:22
合計ジャッジ時間 4,760 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,188 KB
testcase_01 AC 77 ms
75,712 KB
testcase_02 AC 71 ms
75,384 KB
testcase_03 AC 72 ms
75,380 KB
testcase_04 AC 77 ms
75,448 KB
testcase_05 AC 73 ms
75,620 KB
testcase_06 AC 76 ms
75,704 KB
testcase_07 AC 73 ms
75,620 KB
testcase_08 AC 73 ms
75,516 KB
testcase_09 AC 70 ms
75,636 KB
testcase_10 AC 67 ms
75,488 KB
testcase_11 AC 67 ms
75,468 KB
testcase_12 AC 74 ms
75,580 KB
testcase_13 AC 69 ms
75,568 KB
testcase_14 AC 66 ms
75,780 KB
testcase_15 AC 75 ms
75,488 KB
testcase_16 AC 71 ms
75,512 KB
testcase_17 AC 74 ms
75,496 KB
testcase_18 AC 76 ms
76,236 KB
testcase_19 AC 70 ms
75,384 KB
testcase_20 AC 75 ms
75,268 KB
testcase_21 AC 71 ms
75,436 KB
testcase_22 AC 73 ms
75,756 KB
testcase_23 AC 66 ms
75,528 KB
testcase_24 AC 73 ms
75,592 KB
testcase_25 AC 71 ms
75,528 KB
testcase_26 AC 74 ms
75,528 KB
testcase_27 AC 63 ms
71,268 KB
testcase_28 AC 65 ms
70,984 KB
testcase_29 AC 62 ms
70,980 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