結果
| 問題 | 
                            No.864 四方演算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             双六
                         | 
                    
| 提出日時 | 2020-07-24 20:42:05 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 64 ms / 1,000 ms | 
| コード長 | 633 bytes | 
| コンパイル時間 | 169 ms | 
| コンパイル使用メモリ | 82,768 KB | 
| 実行使用メモリ | 59,648 KB | 
| 最終ジャッジ日時 | 2024-06-25 19:28:42 | 
| 合計ジャッジ時間 | 2,850 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
ソースコード
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()
            
            
            
        
            
双六