結果
| 問題 | No.2078 魔抜けなパープル |
| コンテスト | |
| ユーザー |
terasa
|
| 提出日時 | 2022-09-28 19:09:07 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 2,000 ms |
| コード長 | 701 bytes |
| 記録 | |
| コンパイル時間 | 299 ms |
| コンパイル使用メモリ | 85,632 KB |
| 実行使用メモリ | 76,416 KB |
| 最終ジャッジ日時 | 2026-05-28 22:07:07 |
| 合計ジャッジ時間 | 1,459 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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