This series is also called Fibonacci series. This series is also called Fibonacci series. A= 1, B= 1, k=3, this is a recursive problem. Is it the rabbit? K≤n caused by "rabbit problem" must meet two conditions to solve the recursive problem: Yes (1) has an initial value, such as A 1 = 6550. ) has a recursive relationship. For example, an = an- 1an-2 (n ≥ 3)) A = b, b = c, generally two or three variables can be set. Generally, two or three variables can be set. K=k 1 stands for three numbers. In a cycle, a 1, a2 and a3 represent three numbers. In the loop, the output c constantly replaces the old value with the new value. They constantly replace the old values with new ones. Ending this operation is called iteration. This operation is called iteration.
Find the first 30 cases of this series 4: There are series, 4/5, 6/9,1015 ... Before finding this series, there are 2/3 series,, and the algorithm block diagram for finding the sum of the first items of this series. Algorithm block diagram of project and. begin
Algorithm analysis: algorithm analysis: for the problem of sequence, we must first find out the general formula; For the problem of sequence, we should first find out the general term formula or the formula of the calculation relationship between the front and rear terms, and find out the formula of the calculation relationship between the front and rear terms according to the formula. In this question, the relationship between the former and the latter is that the numerator of the latter is the denominator of the former plus 1, and the denominator of the latter is the former. Molecules plus mothers. The idea of solving the problem is to find each item and accumulate the value with the circular structure, because it is to find the sum of the first 30 items and accumulate the value, because it is to find the sum of the first 30 items, and the sum of the 30 items is executed 30 times in 30 cycles. 30 1. initial value i=2, j=3, s = 0;; 2. Use n to cycle from 1 to 30. 3.s = s I/j; 4.c = I; I = j 1; J = c j5. Output; Output s; output
S=0,i =2,j=3,n= 1 n≤30
Yes or no
It is necessary. Because the number of questions in a series can generally be determined, it is necessary. Because the number of times a series of questions can be executed can usually be determined,
S=S i/j C=i,i=j 1,j=c j n=n 1
Output s output is over.
Example 5: Urban water shortage:
Outstanding, outstanding, in order to formulate water-saving management measures and water-saving management measures, the average monthly water consumption of residents in the city in a certain year was sampled, and the average monthly water consumption of n residents was sampled, among which the average monthly water consumption of one resident was x and the water consumption was 1...Xn (unit: ton). According to the program block diagram shown in the figure, the program block diagram is displayed. If n=2, which are 1, 2, x 1 and x2 are 0, the output result s is 0, and the output result is 0.
begin
Enter n, x enter 1, x2, …xn.
s 1=0,s2=0,i = 1 i = i 1
112s = (s2s1) ii is S 1 = S 1 x i.
i≤n
No output s output
end
s2 = s2 x
2 i