結果

問題 No.2078 魔抜けなパープル
ユーザー titiatitia
提出日時 2022-09-25 22:04:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 8,024 KB
最終ジャッジ日時 2023-08-24 02:14:18
合計ジャッジ時間 9,606 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
7,852 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 AC 958 ms
7,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for tests in range(T):
    X,A=map(int,input().split())

    ANS=A*(1*1+X)

    r=A//2
    rest=A%2

    ANS2=r*(2*2+X)+rest*(1*1+X)

    ANS=min(ANS,ANS2)

    for i in range(2,A):
        r=A//i
        rest=A-r*i

        ANS2=(r-rest)*(i*i+X)+rest*((i+1)*(i+1)+X)

        ANS=min(ANS,ANS2)

    print(ANS)

        
0