結果
問題 | No.2078 魔抜けなパープル |
ユーザー |
|
提出日時 | 2022-12-12 21:38:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 506 ms |
コンパイル使用メモリ | 66,304 KB |
最終ジャッジ日時 | 2025-02-09 10:35:58 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; const ll INF = 1000000000000000000; int main() { int t; cin >> t; while (t--) { ll x, a; cin >> x >> a; ll ans = INF; for (int i = 1; i <= a; i++) { ans = min(ans, a % i * (a / i + 1) * (a / i + 1) + (i - a % i) * (a / i) * (a / i) + x * i); } cout << ans << endl; } }