結果

問題 No.864 四方演算
ユーザー Ribura
提出日時 2020-05-19 01:50:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 552 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-01 22:26:09
合計ジャッジ時間 3,808 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n // i)
    return divisors


n, k = map(int, read().split())
k = make_divisors(k)
print(sum(max(x - 1 if n >= x else 2 * n + 1 - x, 0) * max(y - 1 if n >= y else 2 * n + 1 - y, 0) * (2 if x != y else 1) for x, y in zip(k[::2], k[1::2])))
0