結果

問題 No.2078 魔抜けなパープル
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-09-25 23:20:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 75,856 KB
最終ジャッジ日時 2023-08-24 02:33:21
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
75,788 KB
testcase_01 AC 115 ms
75,632 KB
testcase_02 AC 106 ms
75,688 KB
testcase_03 AC 113 ms
75,576 KB
testcase_04 AC 105 ms
75,740 KB
testcase_05 AC 105 ms
75,712 KB
testcase_06 AC 134 ms
75,856 KB
testcase_07 AC 104 ms
75,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    x,a = map(int,input().split())
    inf = 10**20

    ans = inf
    for i in range(1,a+1):
        num = (a+i-1)//i
        over = num*i-a

        count = (num**2+x)*(i-over)
        if over:
            count += ((num-1)**2+x)*over

        ans = min(ans,count)
    print(ans)
    

t = int(input())
for _ in range(t):
    solve()
0