結果

問題 No.864 四方演算
コンテスト
ユーザー salmon0852
提出日時 2022-07-14 22:02:33
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 180 ms / 1,000 ms
+ 755µs
コード長 352 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 302 ms
コンパイル使用メモリ 21,408 KB
実行使用メモリ 15,996 KB
最終ジャッジ日時 2026-07-30 09:07:47
合計ジャッジ時間 6,412 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, k = int(input()), int(input())
sq_k = int(k ** 0.5)

ans = 0
for i in range(1, min(sq_k + 1, 2 * n + 1)):
    if k % i: continue
    j = k // i
    if i > j: break
    if j > 2 * n: continue
    
    a = i - 1 if i <= n else 2 * n - i + 1
    b = j - 1 if j <= n else 2 * n - j + 1
    tmp = a * b
    ans += tmp if i == j else 2 * tmp

print(ans)

0