結果
| 問題 |
No.2078 魔抜けなパープル
|
| コンテスト | |
| ユーザー |
tokumini_ss
|
| 提出日時 | 2022-09-25 21:05:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 469 bytes |
| コンパイル時間 | 2,035 ms |
| コンパイル使用メモリ | 192,600 KB |
| 最終ジャッジ日時 | 2025-02-07 15:08:09 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void solve() {
int64_t X, A;
cin >> X >> A;
int64_t ans = LLONG_MAX;
for (int64_t n = 1; n <= A; n++) {
const int64_t a = A / n;
const int64_t m = A % n;
const int64_t curr_ans = n * X + (a + 1) * (a + 1) * m + a * a * (n - m);
ans = min(ans, curr_ans);
}
cout << ans << endl;
}
int main() {
int64_t T;
cin >> T;
while (T--) {
solve();
}
}
tokumini_ss