PROBLEM LINK:
Author: Akash Kumar Bhagat
Tester: Sandeep Singh, Arnab Chanda
Editorialist: Akash Kumar Bhagat
DIFFICULTY:
CAKEWALK
PREREQUISITES:
MATHS
PROBLEM:
Given the dimension of two rectangular sheets, check whether one can form a square by joining these two sheets or not.
EXPLANATION:
Given two sheets of dimention L_1 X B_1 and L_2 X B_2,there are only one cases for this(if we consider L>B):
-If L_1 = L_2 and L_1=B_1 + B_2 then it will be possible to make a square
SOLUTIONS:
CPP
#include <bits/stdc++.h>
#define ll long long int
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define scanarr(a,b,c) for( i=b;i<c;i++)cin>>a[i]
#define showarr(a,b,c) for( i=b;i<c;i++)cout<<a[i]<<' '
#define ln cout<<'\n'
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define MAX 100005
using namespace std;
////////////////////////////////////////////////////////////////CODE STARTS HERE////////////////////////////////////////////////////////////////
void solve(){
ll l1,l2,b1,b2;
cin >> l1 >> b1;
cin >> l2 >> b2;
string ans = "NO";
if((l1 == l2 && l1 == (b1 + b2)) || (l1 == b2 && l1 == (b1 + l2)) || (b1 == l2 && b1 == (l1 + b2)) || (b1 == b2 && b1 == (l1 + l2)))
ans = "YES";
cout<<ans<<endl;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
int t;
cin>>t;
while(t--)
solve();
}
Python 3
for i in range(int(input())):
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans="YES" if(a[0]==b[0] and a[1]+b[1]==a[0]) else "NO"
print(ans)