CF1811D.Umka and a Long Flight

普及/提高-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The girl Umka loves to travel and participate in math olympiads. One day she was flying by plane to the next olympiad and out of boredom explored a huge checkered sheet of paper.

Denote the nn-th Fibonacci number as Fn={1,n=0;1,n=1;Fn−2+Fn−1,n≥2.F_n = \begin{cases} 1, & n = 0; \\ 1, & n = 1; \\ F_{n-2} + F_{n-1}, & n \ge 2. \end{cases}

A checkered rectangle with a height of FnF_n and a width of Fn+1F_{n+1} is called a Fibonacci rectangle of order nn.

Umka has a Fibonacci rectangle of order nn. Someone colored a cell in it at the intersection of the row xx and the column yy.

It is necessary to cut this rectangle exactly into n+1n+1 squares in such way that

  • the painted cell was in a square with a side of 11;
  • there was at most one pair of squares with equal sides;
  • the side of each square was equal to a Fibonacci number.

Will Umka be able to cut this rectangle in that way?

女孩乌姆卡热爱旅行和参加数学奥林匹克竞赛。一天,她乘飞机前往下一场奥赛,在无聊之际,开始研究一张巨大的方格纸。

记第 nn 个斐波那契数为

Fn={1,n=0;1,n=1;Fn−2+Fn−1,n≥2.F_n = \begin{cases} 1, & n = 0; \\ 1, & n = 1; \\ F_{n-2} + F_{n-1}, & n \ge 2. \end{cases}

一个高为 FnF_n、宽为 Fn+1F_{n+1} 的方格矩形被称为 nn 阶斐波那契矩形。

乌姆卡有一个 nn 阶斐波那契矩形。某人将其中位于第 xx 行、第 yy 列的方格涂上了颜色。

现在需要将该矩形恰好切成 n+1n+1 个正方形,使得:

  • 被涂色的方格位于一个边长为 11 的正方形内;
  • 所有正方形中,至多有一对正方形边长相等(即其余所有正方形边长互不相同);
  • 每个正方形的边长均为某个斐波那契数。

乌姆卡能否以这种方式完成切割?

输入格式

The first line contains an integer tt (1≤t≤2⋅1051 \le t \le 2 \cdot 10^5) — number of test cases.

For each test case the integers nn, xx, yy are given (1≤n≤441 \le n \le 44, 1≤x≤Fn1 \le x \le F_n, 1≤y≤Fn+11 \le y \le F_{n+1}) — the order of the Fibonacci rectangle and the coordinates of the colored cell.

第一行包含一个整数 tt(1≤t≤2⋅1051 \le t \le 2 \cdot 10^5)—— 测试用例的数量。

对于每个测试用例,给定整数 nn、xx、yy(1≤n≤441 \le n \le 44,1≤x≤Fn1 \le x \le F_n,1≤y≤Fn+11 \le y \le F_{n+1})—— 斐波那契矩形的阶数以及着色单元格的坐标。

输出格式

For each test case, print "YES" if the answer is positive, and "NO" otherwise.

You can print "YES" and "NO" in any case (for example, the strings "yEs", "yes" and "Yes" will be recognized as a positive answer).

对于每个测试用例,如果答案为肯定,则输出 “YES”;否则输出 “NO”。

“YES” 和 “NO” 可以以任意大小写形式输出(例如,字符串 “yEs”、“yes” 和 “Yes” 均被视为肯定回答)。

输入输出样例

  • 输入#1

    12
    1 1 1
    2 1 2
    3 1 4
    3 3 2
    4 4 6
    4 3 3
    5 6 5
    5 4 12
    5 2 12
    4 2 1
    1 1 2
    44 758465880 1277583853

    输出#1

    YES
    NO
    YES
    YES
    YES
    NO
    YES
    NO
    NO
    YES
    YES
    NO

说明/提示

The first, third and fourth test cases.

第一、第三和第四个测试用例。

输入解题思路,AI测评打分。不知道怎么写?

首页