| 比赛 |
2026.1.8 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
教练的烦恼 |
最终得分 |
100 |
| 用户昵称 |
yyswys |
运行时间 |
0.043 s |
| 代码语言 |
C++ |
内存使用 |
3.70 MiB |
| 提交时间 |
2026-01-08 20:11:32 |
显示代码纯文本
#include<bits/stdc++.h>
#define cin std::cin
#define cout std::cout
#define ciallo ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;
const int N=2e5+5;
int n;
ll ans,p,q;
int main(){
freopen("money.in","r",stdin);
freopen("money.out","w",stdout);
ciallo
cin>>n>>p>>q;
ans=100000000000005;
for(int i(0);i<=n;++i){
ll res=i*q;
ll k=(n-i)/(i+1ll),l=(n-i)%(i+1ll);
res+=p*(i+1-l)*k*k+p*l*(k+1ll)*(k+1ll);
ans=min(ans,res);
}
cout<<ans<<"\n";
return 0;
}