比赛 2026.1.8 评测结果 RRRRRRRRRRRRRRRRRRRR
题目名称 最大价值 最终得分 0
用户昵称 汐汐很希希 运行时间 0.052 s
代码语言 C++ 内存使用 3.65 MiB
提交时间 2026-01-08 21:29:33
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10;
const int M=5e5+10;
const int MOD=998245353;
const int MAXX=2147483647;
ll n,p,q,ans=MAXX;
ll js(ll px,ll fg)
{
	ll x=px/fg,y=px%fg;
	return p*(fg-y)*x*x+p*y*(x+1)*(x+1);
}
int main()
{
	freopen("money.in","r",stdin);
    freopen("money.out","w",stdout);
    
    cin>>n>>p>>q;
    ans=p*n*n;
    for(ll i=1;i<=n;i++) ans=min(ans,i*q+js(n-i,i+1));
    cout<<ans<<endl;
    return 0;
}