555, and lijun designed two-day questions, actually accidentally sent them to them, they have been disclosed, I have to return it ... Well, the following is last, now useless, I have to put it on this. !
FIBONACCI number
In 1201, Italian mathematician Fibonacci discovered a number of numbers named by his own name - Fibonacci. He found this number in studying the growth of rabbits and reproduction. He used FN to represent the logarithm of rabbit after n month. Because from a new rabbit start, F0 = 1, f1 = 1, then, the next item is obtained by the Fn = Fn-2 Fn-1. Now give you any integer N (1 Sample input: 10 3 4 5 Sample output: NO Yes 3 NO Yes 4 2. Origami Do you like origami? Give you a lot of paper, fold after the confault, and then fold. . . . . . Every time you go from right to the left, after you have been folded many times, the original large paper will become a narrow note. Now open this note along the traces of origami, only open "half" each time, that is, make each trace into a right angle, then look at the side of the paper, look at the parallelism, will see A wonderful curve. For example, if you fold 4 times, then you will see the curve shown in Figure 1 below. Note that the curve is not self-tracing, although there are two turning points over. Give the number of configures, program the plotted curve that is generated after opening. Figure 1 Curve formed after 4 times Sample input: 2 4 1 Sample output: | _ _ _ | ^ _ _ _ | _ | _ | | _ _ _ | _ | | _ | ^ _ | ^ 3. Tree reconstruction The BFS (wide priority traversal) sequence and DFS (depth priority traversal) sequence are given, and a program is designed to re-establish this tree (Number N <= 1000). When a node is expanded, all of its children should be accessed from small to large. For example, the BFS sequence of a tree is 4 3 5 1 2 8 7 6, and the DFS sequence is 4 3 1 7 2 6 5 8, and a tree satisfying the condition is as shown in Figure 2: Figure 2 A tree that meets the conditions 4. Touching the game I believe that many people have played against the game (also known as the Bao Bao Bing). In this game, there are 64 different gems in a 8 * 8 chessboard, each round, you can exchange any two adjacent gems to get a new state, at this time, as long as there are three or three The same gem is connected to a horizontal or vertical, then these gems will eliminate, while the gemstones above fills the space. Now, your task is to analyze a given chess state, exchange a gem, then tell me how many gems can be eliminated. Assuming that the given chess game does not have the case where it is possible. The input of the chess game includes 8 rows, each line contains 8 uppercase letters, and different letters represent different kinds of gems. Enter the following two cases: Aabbaabb Aabbaabb Bbaabbaa Bbaabbaa Aabbaabb Aabbaabb Bbaabbaa Bbaabbaaaabbaabbbb Bbaabbaa Aabbaabb Bbaabbaa Aabbaabb Bbaabbaa Aabbaabb Bbaabbaa The output results are: 6 6 5. Long digital string Give you a digital string S: 12345678910111213141516171819202122 ... it is arranged by all natural numbers from small to large. It is currently a digital string S1 (S1 length is not more than 200 numbers), it is easy to know that it will have an endless multiple times in the S string. The trial programming finds the position of its first appearance. For strings " 81 " It first appears in position 27. Such as" 101 " The first position in the first appearance is 10. The input sample is: 81 101 The output sample is: 27 10 6. Mathematics Legend Legend Life is in the XVIII century mathematician likes to play the game below. This game is played by three mathematicians. One of them is a game of live. First of all, the game, the family said a positive integer N. Then he chose two different integers x and y, ranging from 1 to N and telling a player to them, telling another player's product. Every player knows that he is said to be the sum of the selected or product. After that, the player turned in to tell the man to know whether he knew he chose. First of all, the number of the acquired numbers said whether he knows those numbers, then the player who knows the product, etc. As follows: DVW: "Set n to 10." After that, he chose two scope from 1 to 10, and told the player s their sum, telling the player P to product. Gamer s: "I don't know these two numbers." Gamer P: "I don't know these two numbers." Gamer s: "I don't know these two numbers." Gamer P: "I don't know these two numbers." Gamer s: "Oh, now I know, you chose 3 and 6." Enter the number of N and M, the range and the player say "I don't know these two numbers", please find out all the possible numbers of all the number selected by the game. Outputs the first behavior of all possible pairs, and then output these pairs in any order. Sample input 10 4 Sample output 3 2 5 3 6 3 10