YY'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个回答

Judges's Final Problem 怎么编写呢
Judges's Final Problem 怎么写啊
Judges's Final Problem
Buge's Fibonacci Number Problem
Problem Description snowingsea is having Buge’s discrete mathematics lesson, Buge is now talking about the Fibonacci Number. As a bright student, snowingsea, of course, takes it as a piece of cake. He feels boring and soon comes over drowsy. Buge，feels unhappy about him, he knocked at snowingsea’s head, says:”Go to solve the problem on the blackboard!”, snowingsea suddenly wakes up, sees the blackboard written : snowingsea thinks a moment，and writes down: snowingsea has a glance at Buge，Buge smiles without talking, he just makes a little modification on the original problem, then it becomes : The modified problem makes snowingsea nervous, and he doesn't know how to solve it. By the way，Buge is famous for failing students, if snowingsea cannot solve it properly， Buge is very likely to fail snowingsea. But snowingsea has many ACM friends. So，snowingsea is asking the brilliant ACMers for help. Can you help him? Input The input consists of several test cases. The first line contains an integer T representing the number of test cases. Each test case contains 7 integers, they are f1, f2, a, b, k, n, m which were just mentioned above, where 0 < f1, f2, a, b, n, m < 1000 000 000, and 0 ≤ k < 50. Output For each case, you should print just one line, which contains S(n,k) %m. Sample Input 3 1 1 1 1 1 2 100000 1 1 1 1 1 3 100000 1 1 1 1 1 4 100000 Sample Output 2 4 7
gxx's Problem 程序怎么做的
Problem Description In ACM_DIY, there is a master called “gxx”. Whenever someone asks a problem, he will come out with the Source (such as “in ** OJ, the ID to this problem is **”), then say “The Problem is ShaX……Isn’t it a problem that you should kill in a second? ……” or something like that. One day, one giantarum called ac wants to ask something about the common point(s) of two given “Segments”. Each segment is described as two points in 2D. Of course, gxx says: “It’s a problem that could be killed in one second!” However, the giantarum ac does not know how to solve this problem, could you help him? Input The first line contains one integer T, indicates the number of the test cases. (T <= 100) Then every case has two lines. Each line has four integer numbers x0 y0 x1 y1, indicates the two end-points of the segment. (0<=|x0|, |y0|, |x1|, |y1| <= 10^6) All the test cases are seperated by a single blank line. Output Output one integer M in a single line, indicates the number of common point(s) of the two given segment. Then M lines, each line has two fractions in lowest term indicate the common point. (Of course, if the denominator is one, then you should ignore it!) Obviously, if lots of points could be found, just output one line “INF”. Sample Input 5 0 0 1 1 1 0 0 1 0 0 1 0 1 1 2 2 0 0 -1 -1 -1 0 0 -1 0 0 2 2 2 2 4 0 0 0 1 1 0 0 1 1 Sample Output 1 1/2 1/2 0 1 -1/2 -1/2 1 2 2 INF
A Simple Problem
Problem Description For a given positive integer n, please find the smallest positive integer x that we can find an integer y such that y^2 = n +x^2. Input The first line is an integer T, which is the the number of cases. Then T line followed each containing an integer n (1<=n <= 10^9). Output For each integer n, please print output the x in a single line, if x does not exit , print -1 instead. Sample Input 2 2 3 Sample Output -1 1
Length of S(n) 求和的问题
Problem Description A number sequence is defined as following: S(1)=1, S(2)=11, S(3)=21, S(4)=1211, S(5)=111221, S(6)=312211, …… Now, we need you to calculate the length of S(n). Input The input consists of multiple test cases. Each test case contains one integers n. (1<=n<=30) n=0 signal the end of input. Output Length of S(n). Sample Input 2 5 0 Sample Output 2 6
Ji-Tu Problem 如何来实现
Problem Description There are some chickens and rabbits in the cage. They have fifteen heads and forty feet in all. How many chickens and rabbits are there respectively? It is a classical math problem which can date back to the Northern and Southern Dynasties (420-589). Here is an interesting algorithm to solve the problem: Assume that the chickens and rabbits are well trained. You whistle, and all of them lift a leg, then there are 40-15 = 25 feet on the floor. You whistle again, and there are 25 - 15 = 10 legs remain standing. After two whistles, all the chickens sit on the floor, and all the rabbits stand on two legs. So there are 10/2 = 5 rabbits and 15 - 5 = 10 chickens. John has a farm with lots of animals in it. He is now facing the similar problem. There are exactly N kinds of animals and he wants to know their quantities. He only knows that different kinds of animals have different number of legs (at least one), but he has no idea how many legs they each have. He trains the animals and tries to figure it out using the algorithm stated above. First he makes all the animals stand up with all their legs and counts their legs. then, for each time he whistles, all the animals lift one leg(if it has at least one leg standing on the ground), and then he counts the feet again. After K times, he thinks that it is enough to determine the quantity of each kind of animal, but does it really work? So, it is your job to help him to solve the problem. Input The first line contains an integer T(1 <= T <= 100), indicating the number of test cases. Each test case contains two lines. The first line contains two integers N(1 <= N <= 1000) and K(1 <= K <= 1000), representing the number of different kinds of animals and the time he whistles. The second line contains K + 1 integers A0,A1 ... AK(0 <= Ai <= 104) where Ai represents the number of legs after his ith whistle. Output For each test case in the input, print several lines. The first line contains "Case #X:", where X is the test case number (starting with 1). The next line contains "No Solution", "Unique Solution" or "Multiple Solutions" according to the result. If the result is uniquely determined, you should print N extra lines each contains two integer Li,Ni, where Li represents how many legs does the ith kind of animal have and Ni represents the number of ith kind of animal. The animals should be sorted by the number of their legs in ascending order. Sample Input 3 2 3 14 9 6 3 2 2 8 5 3 3 2 20 13 8 Sample Output Case #1: Unique Solution 1 2 4 3 Case #2: No Solution Case #3: Multiple Solutions
A high-dimensional problem
Problem Description As we all know, a point in n-dimensional space can be represented as a vector (x1, x2, ..., xn), where xi is a real number. Given a vector D = (d1, d2, ..., dn), we can generate a series of planes perpendicular to D: each plane satisfies the condition that for any two point on the plane, say A = (a1, a2, ..., an), B = (b1, b2, ..., bn), the inner product of (A - B) and D is zero, ie. (a1 - b1) * d1 + (a2 - b2) * d2 + ... + (an - bn) * dn = 0, and we call D the normal vector of the plane. let A * B denotes the inner product of A and B. Here are n planes in n-dimensional space: S1, S2, ..., Sn with normal vector D1, D2, ..., Dn respectively. And P1, P2, ..., Pn lies on S1, S2,..., Sn respectively. We don't know the coordinates of P1, P2, ..., Pn, but instead we know D1 * P1, D2 * D2, ..., Dn * Pn. Can we find out the point of intersection of S1, S2, ..., Sn? Input There will be multiple test cases. Each data set will be formatted according to the following description: 1. A line containing two integers n, m, 3 <= n <= 100, 1 <= m <= n, m represents the number of queries to the same D1, D2, ..., Dn. 2. line 1 + i(1 <= i <= n) : n real number denoting the coordinates of Di. 3. line 1 + n + i(1 <= i <= m): n real number denoting D1 * P1, D2 * P2, ..., Dn * Pn. Output For each test data, there will be exactly m lines. For each query output a line containing the coordinates of the point of intersetion of S1, S2, ..., Sn.Round all the coordinates to the second digit after the decimal point.You may assume there will always be exactly one such point Sample Input 3 1 1 0 0 0 1 0 0 0 1 1 1 1 Sample Output 1.00 1.00 1.00
Settling Salesman Problem 是怎么写呢
Problem Description After travelling around for years, Salesman John has decided to settle. He wants to build a new house close to his customers, so he doesn't have to travel as much any more. Luckily John knows the location of all of his customers. All of the customers' locations are at (distinct) integer coordinates. John's new house should also be built on integer coordinates, which cannot be the same as any of the customers' locations. Since John lives in a large and crowded city, the travelling distance to any customer is the Manhattan distance: |x - xi| + |y - yi|, where (x, y) and (xi, yi) are the coordinates of the new house and a customer respectively. What is the number of locations where John could settle, so the sum of the distance to all of his customers is as low as posible? Input On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case: One line with an integer n (1 <= n <= 2 000): the number of customers John has. n lines with two integers xi and yi (-1 000 000 000 <= xi, yi <= 1 000 000 000): the coordinates of the i-th customer. Output For each test case: Two space-separated integers: the minimum summed distance to all customers, and the number of spots on which John can build his new house to achieve this minimum. Sample Input 2 4 1 -3 0 1 -2 1 1 -1 2 -999888777 1000000000 1000000000 -987654321 Sample Output 10 4 3987543098 3975087573110998514
Settling Salesman Problem 怎么做呢
Problem Description After travelling around for years, Salesman John has decided to settle. He wants to build a new house close to his customers, so he doesn't have to travel as much any more. Luckily John knows the location of all of his customers. All of the customers' locations are at (distinct) integer coordinates. John's new house should also be built on integer coordinates, which cannot be the same as any of the customers' locations. Since John lives in a large and crowded city, the travelling distance to any customer is the Manhattan distance: |x - xi| + |y - yi|, where (x, y) and (xi, yi) are the coordinates of the new house and a customer respectively. What is the number of locations where John could settle, so the sum of the distance to all of his customers is as low as posible? Input On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case: One line with an integer n (1 <= n <= 2 000): the number of customers John has. n lines with two integers xi and yi (-1 000 000 000 <= xi, yi <= 1 000 000 000): the coordinates of the i-th customer. Output For each test case: Two space-separated integers: the minimum summed distance to all customers, and the number of spots on which John can build his new house to achieve this minimum. Sample Input 2 4 1 -3 0 1 -2 1 1 -1 2 -999888777 1000000000 1000000000 -987654321 Sample Output 10 4 3987543098 3975087573110998514
Judges's Final Problem 这个程序的实现
Renovation Problem正确解答
Problem Description The New Year’s Day is comming ! Every family want to make theiir house looks more beautiful , so does Teddy’s . To make his own house looks different from other's , he went to the shop to buy four kinds of tiles . each kind of tiles has different size : 1*1 , 2*2 , 3*3 and 4 * 4, respectively . The problem is , how many ways there are to tile his floor which has a area of 4*N using these four kinds of tiles ? You can assume that the number of each kind of tiles is enough. Input The first line contain a T. followed by T lines ,each line contain a integer N.(1<=N <=100). Output For each case, output the ans % 19890907. Sample Input 2 1 2 Sample Output 1 5
Judges's Final Problem 怎么用C语言
A + B Problem Too
Problem Description This problem is also a A + B problem,but it has a little difference,you should determine does (a+b) could be divided with 86.For example ,if (A+B)=98,you should output no for result. Input Each line will contain two integers A and B. Process to end of file. Output For each case, if(A+B)%86=0,output yes in one line,else output no in one line. Sample Input 1 1 8600 8600 Sample Output no yes
Repeating Characters 字符的重复问题
Problem Description For this problem, you will write a program that takes a string of characters, S, and creates a new string of characters, T, with each character repaeated R times. That is, R copies of the first character of S, followed by R copies of the second character of S, and so on. Valid characters for S are the QR Code "alphanumeric" characters: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \$ % * + - . / : Input The first line of input contains a single integer P,(1 <= P <= 1000), which is the number of data sets that follow. Each data set is a single ling of input consisting of the data set number N, followed by a space, followed by the repeat count R, (1 <= R <= 8), followed by a space , followed by the string S. The length of string S will always be at least one and no more than 20 characters. All the characters will be from the set of characters shown above. Output For each data set there is one ling of output. It contains the data set number, N, followed by a single space which is then followed by the new string T, which is made of each character in S repeated R times. Sample Input 2 1 3 ABC 2 5 /HTP Sample Output 1 AAABBBCCC 2 /////HHHHHTTTTTTPPPPP
A Famous King’s Trip 旅行的问题
God's Birthday 日期的问题
Problem Description Do you know God's birthday? Stupid Wiskey and Michelle say they didn't knew. Now, Gods want to make a game let them guess the answer. This game is a two-player alternative game and is played as follows: 1.God tell the month to Wiskey, and tell the day to Michelle. 2.There are many dates in a list, Wiskey and Michelle must choose the date from the list. 3.Wiskey guesses first, then Michelle and alternative to reply YES or NO, if he/she konws the answer, he/she will say YES, or he/she will say NO. 4.Who first know God's birthday when is his/her turn and his/her answer is right, he/she is the winner. Your task is telling me who will win, Wiskey or Michelle? Input First line will contain one integer means how many cases will follow by. Each line will contain three integers N, M, D. N represents the number of dates God tell them. (1 <= N <= 365) M, D represent God's birthday is the M-th month, the D-th day. (1 <= M <= 12, 1 <= D <= 31) Output If Wiskey win, print "Wiskey Win". If Michelle wins, print "Michelle Win". Else print "No" if nobody will win the game. Sample Input 4 3 12 25 12 25 10 25 11 25 3 12 25 12 25 12 23 12 24 4 12 25 11 25 11 25 12 24 12 24 3 12 25 11 25 12 25 12 24 Sample Output Wiskey Win Michelle Win No Michelle Win
Java学习的正确打开方式

linux系列之常用运维命令整理笔录

Vue + Spring Boot 项目实战（十四）：用户认证方案与完善的访问拦截

Python十大装B语法
Python 是一种代表简单思想的语言，其语法相对简单，很容易上手。不过，如果就此小视 Python 语法的精妙和深邃，那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点，并附上详细的实例代码。如能在实战中融会贯通、灵活使用，必将使代码更为精炼、高效，同时也会极大提升代码B格，使之看上去更老练，读起来更优雅。 1. for - else 什么？不是 if 和 else 才

2019年11月中国大陆编程语言排行榜
2019年11月2日，我统计了某招聘网站，获得有效程序员招聘数据9万条。针对招聘信息，提取编程语言关键字，并统计如下： 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7

SQL-小白最佳入门sql查询一

“狗屁不通文章生成器”登顶GitHub热榜，分分钟写出万字形式主义大作

IT界知名的程序员曾说：对于那些月薪三万以下，自称IT工程师的码农们，其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居，但只是他们一厢情愿罢了。 此话一出，不知激起了多少(码农)程序员的愤怒，却又无可奈何，于是码农问程序员。 码农：你知道get和post请求到底有什么区别？ 程序员：你看这篇就知道了。 码农：你月薪三万了？ 程序员：嗯。 码农：你是怎么做到的? 程序员：
《程序人生》系列-这个程序员只用了20行代码就拿了冠军

11月8日，由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办，科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。 　　区块链技术被认为是继蒸汽机、电力、互联网之后，下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力，电力解决了人类基本的生活需求，互联网彻底改变了信息传递的方式，区块链作为构造信任的技术有重要的价值。 　　1

【技巧总结】位运算装逼指南

《C++ Primer》学习笔记（六）：C++模块设计——函数

8年经验面试官详解 Java 面试秘诀
作者 | 胡书敏 责编 | 刘静 出品 | CSDN（ID：CSDNnews） 本人目前在一家知名外企担任架构师，而且最近八年来，在多家外企和互联网公司担任Java技术面试官，前后累计面试了有两三百位候选人。在本文里，就将结合本人的面试经验，针对Java初学者、Java初级开发和Java开发，给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实

1.两种思维方式在求职面试中，经常会考察这种问题：北京有多少量特斯拉汽车？ 某胡同口的煎饼摊一年能卖出多少个煎饼？ 深圳有多少个产品经理？ 一辆公交车里能装下多少个乒乓球？ 一
so easy！ 10行代码写个"狗屁不通"文章生成器

MySQL数据库总结