結果

問題 No.864 四方演算
ユーザー RiburaRibura
提出日時 2020-05-19 01:45:46
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 98 ms / 1,000 ms
コード長 635 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 7,952 KB
最終ジャッジ日時 2023-07-25 03:39:07
合計ジャッジ時間 3,420 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,804 KB
testcase_01 AC 98 ms
7,928 KB
testcase_02 AC 72 ms
7,796 KB
testcase_03 AC 79 ms
7,788 KB
testcase_04 AC 87 ms
7,716 KB
testcase_05 AC 67 ms
7,792 KB
testcase_06 AC 88 ms
7,916 KB
testcase_07 AC 80 ms
7,816 KB
testcase_08 AC 71 ms
7,808 KB
testcase_09 AC 49 ms
7,908 KB
testcase_10 AC 45 ms
7,792 KB
testcase_11 AC 30 ms
7,788 KB
testcase_12 AC 73 ms
7,820 KB
testcase_13 AC 56 ms
7,792 KB
testcase_14 AC 33 ms
7,792 KB
testcase_15 AC 98 ms
7,720 KB
testcase_16 AC 76 ms
7,800 KB
testcase_17 AC 85 ms
7,792 KB
testcase_18 AC 77 ms
7,860 KB
testcase_19 AC 63 ms
7,940 KB
testcase_20 AC 89 ms
7,792 KB
testcase_21 AC 76 ms
7,796 KB
testcase_22 AC 69 ms
7,916 KB
testcase_23 AC 23 ms
7,860 KB
testcase_24 AC 64 ms
7,828 KB
testcase_25 AC 41 ms
7,952 KB
testcase_26 AC 69 ms
7,800 KB
testcase_27 AC 16 ms
7,812 KB
testcase_28 AC 15 ms
7,744 KB
testcase_29 AC 16 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

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 = int(readline())
k = int(readline())
k = make_divisors(k)
ans = 0
for x, y in zip(k[::2], k[1::2]):
    xx = x - 1 if n >= x else 2 * n + 1 - x
    yy = y - 1 if n >= y else 2 * n + 1 - y
    xy = xx * yy
    if xy >= 0:
        if x != y:
            xy *= 2
        ans += xy
print(ans)
0