A15776 | Umka and a Long Flight
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $n$ -th Fibonacci number as $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 $F_n$ and a width of $F_{n+1}$ is called a Fibonacci rectangle of order $n$ .
Umka has a Fibonacci rectangle of order $n$ . Someone colored a cell in it at the intersection of the row $x$ and the column $y$ .
It is necessary to cut this rectangle exactly into $n+1$ squares in such way that
- the painted cell was in a square with a side of $1$ ;
- 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?
Denote the $n$ -th Fibonacci number as $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 $F_n$ and a width of $F_{n+1}$ is called a Fibonacci rectangle of order $n$ .
Umka has a Fibonacci rectangle of order $n$ . Someone colored a cell in it at the intersection of the row $x$ and the column $y$ .
It is necessary to cut this rectangle exactly into $n+1$ squares in such way that
- the painted cell was in a square with a side of $1$ ;
- 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?
输入格式
The first line contains an integer $t$ ( $1 \le t \le 2 \cdot 10^5$ ) — number of test cases.
For each test case the integers $n$ , $x$ , $y$ are given ( $1 \le n \le 44$ , $1 \le x \le F_n$ , $1 \le y \le F_{n+1}$ ) — the order of the Fibonacci rectangle and the coordinates of the colored cell.
For each test case the integers $n$ , $x$ , $y$ are given ( $1 \le n \le 44$ , $1 \le x \le F_n$ , $1 \le y \le F_{n+1}$ ) — the order of the Fibonacci rectangle and the coordinates of the colored cell.
输出格式
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).
You can print "YES" and "NO" in any case (for example, the strings "yEs", "yes" and "Yes" will be recognized as a positive answer).
输入输出样例
输入 #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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted