結果

問題 No.864 四方演算
ユーザー 双六双六
提出日時 2020-07-24 20:42:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 1,000 ms
コード長 633 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 77,688 KB
最終ジャッジ日時 2023-09-08 02:22:21
合計ジャッジ時間 5,496 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,840 KB
testcase_01 AC 108 ms
76,836 KB
testcase_02 AC 104 ms
77,208 KB
testcase_03 AC 103 ms
76,812 KB
testcase_04 AC 106 ms
76,988 KB
testcase_05 AC 101 ms
76,968 KB
testcase_06 AC 107 ms
76,952 KB
testcase_07 AC 105 ms
76,924 KB
testcase_08 AC 102 ms
76,612 KB
testcase_09 AC 99 ms
76,892 KB
testcase_10 AC 101 ms
76,864 KB
testcase_11 AC 95 ms
76,864 KB
testcase_12 AC 105 ms
76,600 KB
testcase_13 AC 100 ms
76,932 KB
testcase_14 AC 97 ms
77,104 KB
testcase_15 AC 109 ms
76,820 KB
testcase_16 AC 105 ms
76,588 KB
testcase_17 AC 108 ms
76,744 KB
testcase_18 AC 107 ms
77,688 KB
testcase_19 AC 103 ms
76,748 KB
testcase_20 AC 111 ms
76,944 KB
testcase_21 AC 104 ms
76,720 KB
testcase_22 AC 104 ms
76,848 KB
testcase_23 AC 96 ms
76,840 KB
testcase_24 AC 100 ms
76,888 KB
testcase_25 AC 97 ms
76,824 KB
testcase_26 AC 103 ms
77,208 KB
testcase_27 AC 87 ms
72,120 KB
testcase_28 AC 88 ms
72,056 KB
testcase_29 AC 88 ms
71,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	K = int(input())
	ans = 0
	M = int(K ** 0.5 // 1)
	for i in range(1, M + 1):
		if K % i == 0:
			j = int(K // i)
			if i <= N:
				a = i - 1
			else:
				a = max(2 * N - i + 1, 0)

			if j <= N:
				b = j - 1
			else:
				b = max(2 * N - j + 1, 0)

			# print(i, j, a, b)

			if i == j:
				ans += a * b
			else:
				ans += 2 * a * b

	print(ans)

if __name__ == '__main__':
	main()
0