Question: {code...} answer: {code...} evaluate the algorithm {code...} question:
Draw 2999 straight lines on a blank sheet of paper. How many pieces of white paper can be divided at most? Write the computing Function
Answer:
//? Function maxBlock ($ num) {// @ todo how to calculate? }
Algorithm
MaxBlock (2999 );
Reply content:
Question:
Draw 2999 straight lines on a blank sheet of paper. How many pieces of white paper can be divided at most? Write the computing Function
Answer:
//? Function maxBlock ($ num) {// @ todo how to calculate? }
Algorithm
MaxBlock (2999 );
A line, as long as it is not parallel to any previous line, it is connected to all lines.
This can be done because the line slope can take any real number and infinity, Which is dense.
A line separates another line, which is equivalent to dividing the area below it.
In this case, we can obtain the recursive formula as follows:S (0) = 1; S (n) = S (n-1) + n;
S is almost the part of an Equality Series. After expansion, it is:S (n) = (1 + n) n/2 + 1;
Okay.S (n)
Is what you wantMaxBlock (n)
.