题解:P18145 [NWRRC 2026] Nuts and Bolts
TuanTuan_Cat · · 题解
思路
设第一块木板上,孔距离左端有
对齐两个孔之后,我们可以发现,木板的总宽度其实就是孔到拼接后木板最左端的最大宽度
代码
AC 记录:https://www.luogu.com.cn/record/313034074
#include<bits/stdc++.h>
using namespace std;
int a,x,b,y,l1,r1,l2,r2;
int main(){
cin>>a>>b>>x>>y;
l1=x,l2=y,r1=a-x,r2=b-y;
cout<<max(l1,l2)+max(r1,r2);
return 0;
}