結果

問題 No.2078 魔抜けなパープル
ユーザー titia
提出日時 2022-09-25 22:02:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-22 14:38:18
合計ジャッジ時間 11,616 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 5 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

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-r*2

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

    ANS=min(ANS,ANS2)

    for i in range(2,A+1):
        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