编程介的小学生
2017-12-10 16:02YY's new problem
Problem Description
Given a permutation P of 1 to N, YY wants to know whether there exists such three elements P[i1], P[i2], P[i3] that
P[i1]-P[i2]=P[i2]-P[i3], 1<=i1<i2<i3<=N.
Input
The first line is T(T<=60), representing the total test cases.
Each test case comes two lines, the former one is N, 3<=N<=10000, the latter is a permutation of 1 to N.
Output
For each test case, just output 'Y' if such i1, i2, i3 can be found, else 'N'.
Sample Input
2
3
1 3 2
4
3 2 4 1
Sample Output
N
Y
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- fsockopen,连接ssl:// imap服务器时证书验证失败
- apache
- imap
- php
- ssl
- 1个回答
- 输入[type = date]格式值在php中动态生成
- html5
- javascript
- php
- jquery
- 2个回答
- 单击保存按钮时应用程序崩溃
- image
- android
- mysql
- php
- 2个回答
- 插入数据不工作php mysql
- mysql
- php
- 4个回答
- Drupal 7.31 - 节点的文件类型字段的问题
- drupal
- php
- 1个回答
换一换