結果

問題 No.2078 魔抜けなパープル
ユーザー ytftytft
提出日時 2022-10-05 22:16:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 76,640 KB
最終ジャッジ日時 2023-08-30 11:59:34
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,764 KB
testcase_01 AC 127 ms
76,156 KB
testcase_02 AC 114 ms
76,224 KB
testcase_03 AC 120 ms
76,108 KB
testcase_04 AC 112 ms
76,216 KB
testcase_05 AC 114 ms
76,184 KB
testcase_06 AC 144 ms
75,992 KB
testcase_07 AC 113 ms
76,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda:sys.stdin.readline().rstrip()
N=int(input())
for i in range(N):
	T,A=map(int,input().split())
	ans=float('inf')
	for j in range(1,A+1):
		ans=min(ans,j*T+(A%j)*(A//j+1)**2+(j-A%j)*(A//j)**2)
	print(ans)
0