結果
| 問題 |
No.2078 魔抜けなパープル
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2022-09-25 21:19:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 406 bytes |
| コンパイル時間 | 1,729 ms |
| コンパイル使用メモリ | 192,984 KB |
| 最終ジャッジ日時 | 2025-02-07 15:13:09 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int T;
cin>>T;
for(int i=0;i<T;i++){
int A,X;
cin>>A>>X;
swap(A,X);
int ans = 1e18;
for(int j=1;j<=A;j++){
int now = j*X;
int a = A/j;
int b = A%j;
now += a*a*(j-b)+(a+1)*(a+1)*b;
ans = min(ans,now);
}
cout<<ans<<endl;
}
}
keisuke6