Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- #include "bits/stdc++.h"
- #include "algorithm"
- using namespace std;
- int main()
- {
- int n,d,e,p;
- //No. of test cases
- cin >> n;
- long a[3],b[2];
- for (int i = 1; i <= n; i++)
- {
- for(int i=0;i<3;i++)
- //a,b,c input
- cin>>a[i];
- //x,y input
- cin >> b[0]>> b[1];
- // sorting
- sort(a, a+3);
- sort(b, b+2);
- // assigning smallest value of a, b, c to d and x, y to e
- d = a[0];
- e = b[0];
- if(e >= d)
- {
- p = e - d;
- //checking if difference of smallest number is less than second largest number
- if(p <= a[1])
- {
- a[1] = a[1] - p;
- if(a[1] + a[2] == b[1])
- {
- cout<<"YES";
- }
- else
- cout<<"NO";
- }
- else
- cout<<"NO";
- }
- else
- cout<<"NO";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment