跳到正文

题解

题解:P13554 【MX-X15-T1】奶龙龙

Night_Echo约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P13554

版本

  1. v1当前

思路:

  • 如果 aa 大于等于 yy,就输出 a×za \times z,因为这时奶龙玩偶有促销,更加便宜。
  • 否则就取 min⁡(y×z,a×x)\min(y \times z,a \times x),因为 y×zy \times z 有可能是小于 a×xa \times x 的。

代码:

C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
int x,y,z,a;
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>x>>y>>z>>a;
	if(a>=y){
		cout<<a*z;
	}
	else{
		cout<<min(y*z,a*x);
	}
	return 0;
}
原文