15 basic algorithm questions with extremely high frequency (with complete code) and extremely high Algorithms
Algorithm pseudocode for a question
I wrapped up this question, and others quickly dispersed. I will tell you the answer tomorrow. Of course, it's just a thought. I have always been a fisherman, not a fish.
I am asleep. Now I will answer your question. Thank you for your support! By the way, I feel that the old outing question is brilliant. I didn't have such a good question to guide the students when I went to school.
Let's take a look at the question first, instead of focusing too much on the details. We can summarize this question in one sentence, which is to convert a series of blocks into messages, and the message consists of multiple pages. This is the high abstraction of a program.
The second step shows what you can use, that is, the three subprograms mentioned in Article 8th. You need to write some programs to call these three subprograms to achieve your goals.
Write multiple blocks and convert them into a message method, and then call this method continuously.
In two steps, the first step is to obtain multiple blocks that constitute a message. The pseudocode is as follows:
While (true)
{
GetBlock;
If (lastBlock. text = "#")
{
Break; // If the block you just obtained contains only one #, it indicates the end of a message. Exit the loop. The array contains all blocks that constitute a message.
}
}
Second, construct a message based on these blocks. Remove spaces at the beginning and end of the block text, and then convert multiple consecutive spaces into one space.
Then, put each word in the block into a temporary string in sequence. Every time the string has enough 100 words, putline is called. If it is not enough, it is not enough to add the next one, if it is too old, do not next, because a word cannot wrap. PutPage is called every 60 lines written until all blocks are used up.
A For-type pseudo-code algorithm
1 9