結果

問題 No.2078 魔抜けなパープル
ユーザー ニックネームニックネーム
提出日時 2022-09-25 21:17:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,612 KB
実行使用メモリ 75,968 KB
最終ジャッジ日時 2023-08-24 01:57:58
合計ジャッジ時間 1,824 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
75,636 KB
testcase_01 AC 118 ms
75,968 KB
testcase_02 AC 104 ms
75,908 KB
testcase_03 AC 111 ms
75,768 KB
testcase_04 AC 105 ms
75,836 KB
testcase_05 AC 105 ms
75,964 KB
testcase_06 AC 141 ms
75,884 KB
testcase_07 AC 103 ms
75,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    x, a = map(int, input().split())
    ans = a**2+x
    for i in range(2, a+1):
        ans = min(ans, (a//i)**2*(i-a%i)+(a//i+1)**2*(a%i)+x*i)
    print(ans)
0