思路
判断优惠触发条件: 如果购买个已经触发优惠,就以折扣价买下; 否则计算只买个不触发优惠和刚好买个触发优惠的价格(因为买更多也不划算了),其中的较小值即为答案。
不过话说也没有哪个商家这么人傻钱多吧。。
Code
# include <bits/stdc++.h>
using namespace std;
int x,y,z,a;
int main(){
cin>>x>>y>>z>>a;
if(a>=y){
cout<<a*z;
}else{
cout<<min(a*x,y*z);
}
return 0;
}