結果
問題 | No.2078 魔抜けなパープル |
ユーザー |
![]() |
提出日時 | 2023-05-20 01:40:12 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 3,317 ms |
コンパイル使用メモリ | 243,172 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 04:20:53 |
合計ジャッジ時間 | 4,079 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int t ; cin>>t; while(t--){ ll x,a; cin>>x>>a; ll ans = 1e15; for(int i = 1;i<=a;i++){ ll now = x * i; ll need = a / i; ll tmp = a % i; now += need * need * (i-tmp); now += (need+1)*(need+1) * tmp; ans = min(ans,now); } cout<<ans<<endl; } }