题解 P6746 【『MdOI R3』Operations】
『MdOI R3』Operations
对着数据范围做题。
首先,当
当
当
当
然后结合这些分析即可 AC 本题。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <queue>
#include <vector>
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;
}
int main()
{
int a=read(),b=read(),c=read(),d=read();
if (a==0 && b==0)
puts("0");
else if (a*b==0)
cout << d << endl;
else if (a==b)
cout << min(c,2*d) << endl;
else
cout << min(c+d,2*d) << endl;
return 0;
}