LOADING

加载过慢请开启缓存,浏览器默认开启

daily 1

2023/5/30

CF 710E

void solve(){
  ll n,x,y;
  cin>>n>>x>>y;
  vector<ll>dp(n+1,INF);
  dp[1]=x;
  for(int i=2;i<=n;++i){
    if(i%2==0){
      dp[i]=min(dp[i],dp[i/2]+y);
    }else{
      dp[i]=min(dp[(i+1)>>1]+x+y,dp[i]);
    }
    dp[i]=min(dp[i-1]+x,dp[i]);
  }
  cout<<dp[n]<<'\n';
  return;
}