結果
| 問題 |
No.2078 魔抜けなパープル
|
| コンテスト | |
| ユーザー |
terasa
|
| 提出日時 | 2022-09-28 19:09:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 133 ms / 2,000 ms |
| コード長 | 701 bytes |
| コンパイル時間 | 386 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 75,392 KB |
| 最終ジャッジ日時 | 2024-12-22 17:43:51 |
| 合計ジャッジ時間 | 2,494 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
from collections import deque
import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
from functools import lru_cache
# for AtCoder Easy test
if __file__ == 'prog.py':
pass
else:
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')
input = sys.stdin.readline
def readints(): return map(int, input().split())
def readlist(): return list(readints())
def readstr(): return input()[:-1]
T = int(input())
for _ in range(T):
X, A = readints()
ans = float('inf')
for i in range(1, A + 1):
p, q = divmod(A, i)
ans = min(ans, p * p * (i - q) + (p + 1) * (p + 1) * q + X * i)
print(ans)
terasa