D. Umka and a Long Flight
思路:奇怪的递归又增加了,我们模拟一下就能够知道,如果要整出n+1个,那么就是正好去掉边长为1,2,3,....w[n]的正方形,并且每次取正方形都是相当于一个直线水平或者竖直分出一部分来,看样例就发现,所以我们用一个check(n,x,y,x1,y1),代表还需要去掉1~n对应的斐波那契值,被染色的店为x,y当前矩形的边长为x1,y1,而且每次割去是能取则取,所以会有5种情况,水平割割留下上面,留下下面,以及竖直分割留下左面,留下右面,以及不能够分割,如果不能够分割了返回false,如果n==0则返回true
// Problem: D. Umka and a Long Flight
// Contest: Codeforces - Codeforces Round 863 (Div. 3)
// URL: https://codeforces.com/contest/1811/problem/D
// Memory Limit: 256 MB
// Time Limit: 3000 ms
#include<iostream>
#include<cstring>
#include<string>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#include<set>
#include<unordered_map>
#include<ctime>
#include<cstdlib>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> PII;
typedef pair<int,pair<int,int> > PIII;
const double eps=1e-7;
const int N=5e5+7 ,M=5e5+7, INF=0x3f3f3f3f,mod=1e9+7;
const long long int llINF=0x3f3f3f3f3f3f3f3f;
inline ll read() {ll x=0,f=1;char c=getchar();while(c<'0'||c>'9') {if(c=='-') f=-1;c=getchar();}
while(c>='0'&&c<='9') {x=(ll)x*10+c-'0';c=getchar();} return x*f;}
inline void write(ll x) {if(x < 0) {putchar('-'); x = -x;}if(x >= 10) write(x / 10);putchar(x % 10 + '0');}
inline void write(ll x,char ch) {write(x);putchar(ch);}
void stin() {freopen("in_put.txt","r",stdin);freopen("my_out_put.txt","w",stdout);}
bool cmp0(int a,int b) {return a>b;}
template<typename T> T gcd(T a,T b) {return b==0?a:gcd(b,a%b);}
template<typename T> T lcm(T a,T b) {return a*b/gcd(a,b);}
void hack() {printf("\n----------------------------------\n");}
int T,hackT;
int n,m,k;
int w[50];
void init() {
w[0]=1,w[1]=1;
for(int i=2;i<=45;i++) w[i]=w[i-1]+w[i-2];
}
bool check(int n,int x,int y,int h,int d) {
if(n==0) return true;
if(x>w[n]) return check(n-1,x-w[n],y,h-w[n],d);
else if(h-x>=w[n]) return check(n-1,x,y,h-w[n],d);
else if(y>w[n]) return check(n-1,x,y-w[n],h,d-w[n]);
else if(d-y>=w[n]) return check(n-1,x,y,h,d-w[n]);
else return false;
}
void solve() {
int n=read();
int x=read(),y=read();
if(check(n,x,y,w[n],w[n+1])) printf("YES\n");
else printf("NO\n");
}
int main() {
init();
// stin();
scanf("%d",&T);
// T=1;
while(T--) hackT++,solve();
return 0;
}