Untitled
#include <bits/stdc++.h> using namespace std; int l1,w1,h1,l2,w2,h2,lc,wc,hc; bool lw(int lx,int wx,int ly,int wy,int lz,int wz) { if (lx+ly<=lz&&wx<=wz&&wy<=wz) { return true; } if (lx+wy<=lz&&wx<=wz&&ly<=wz) { return true; } if (wx+ly<=lz&&lx<=wz&&wy<=wz) { return true; } if (wx+wy<=lz&&lx<=wz&&ly<=wz) { return true; } if (lx+ly<=wz&&wx<=lz&&wy<=lz) { return true; } if (lx+wy<=wz&&wx<=lz&&ly<=lz) { return true; } if (wx+ly<=wz&&lx<=lz&&wy<=lz) { return true; } if (wx+wy<=wz&&lx<=lz&&ly<=lz) { return true; } return 0; } int main() { while (cin>>l1>>w1>>h1>>l2>>w2>>h2>>lc>>wc>>hc) { if (h1<=hc&&h2<=hc&&lw(l1,w1,l2,w2,lc,wc)==1) { cout<<"YES"<<endl; } else cout<<"NO"<<endl; } }
Leave a Comment