結果

問題 No.864 四方演算
ユーザー maspymaspy
提出日時 2020-01-07 02:04:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 155 ms / 1,000 ms
コード長 603 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 46,296 KB
最終ジャッジ日時 2023-08-14 23:02:20
合計ジャッジ時間 6,204 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
46,072 KB
testcase_01 AC 141 ms
46,108 KB
testcase_02 AC 148 ms
46,116 KB
testcase_03 AC 148 ms
46,164 KB
testcase_04 AC 147 ms
46,096 KB
testcase_05 AC 147 ms
46,156 KB
testcase_06 AC 148 ms
46,296 KB
testcase_07 AC 145 ms
45,916 KB
testcase_08 AC 144 ms
46,168 KB
testcase_09 AC 148 ms
46,164 KB
testcase_10 AC 148 ms
46,100 KB
testcase_11 AC 148 ms
46,100 KB
testcase_12 AC 147 ms
46,152 KB
testcase_13 AC 147 ms
46,112 KB
testcase_14 AC 150 ms
46,172 KB
testcase_15 AC 147 ms
46,140 KB
testcase_16 AC 145 ms
46,116 KB
testcase_17 AC 149 ms
46,048 KB
testcase_18 AC 149 ms
46,100 KB
testcase_19 AC 148 ms
46,040 KB
testcase_20 AC 150 ms
46,156 KB
testcase_21 AC 150 ms
46,060 KB
testcase_22 AC 147 ms
46,116 KB
testcase_23 AC 149 ms
46,172 KB
testcase_24 AC 148 ms
46,008 KB
testcase_25 AC 149 ms
46,036 KB
testcase_26 AC 149 ms
46,196 KB
testcase_27 AC 149 ms
45,980 KB
testcase_28 AC 155 ms
46,176 KB
testcase_29 AC 153 ms
45,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# (a+c)(b+d) = K

import numpy as np

N,K = map(int,read().split())

x = np.arange(1, 10**6+10, dtype=np.int64)
div = x[K % x == 0]

div = np.union1d(div, K // div)

AC = div; BD = K // div

# N 以下という条件を反映させる
# a + c = AC
low_a = np.maximum(1,AC-N)
high_a = np.minimum(N,AC-1)
cnt_a = np.maximum(0,high_a - low_a + 1)

low_b = np.maximum(1,BD-N)
high_b = np.minimum(N,BD-1)
cnt_b = np.maximum(0,high_b - low_b + 1)

answer = (cnt_a * cnt_b).sum()
print(answer)
0