結果

問題 No.2078 魔抜けなパープル
ユーザー ニックネームニックネーム
提出日時 2022-09-25 21:17:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,869 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 7,924 KB
最終ジャッジ日時 2023-08-24 01:57:52
合計ジャッジ時間 8,345 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
7,924 KB
testcase_01 AC 1,212 ms
7,832 KB
testcase_02 AC 865 ms
7,868 KB
testcase_03 AC 1,031 ms
7,920 KB
testcase_04 AC 780 ms
7,840 KB
testcase_05 AC 798 ms
7,860 KB
testcase_06 AC 1,869 ms
7,892 KB
testcase_07 AC 857 ms
7,788 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