Coding is to solve a certain problem (whether it is a question on OJ or a project). Before solving the problem, we should fully analyze the problem (mining the implied conditions of the question, analysis of project requirements), coding becomes a matter of course only after you fully understand the problem and have a clear idea. In the past, when I was doing a question on OJ, I used to write code when I saw the question and never analyzed the various conditions of the question. This is wrong.
★What is pseudocode?
Is an algorithm description language. It has many rules. In fact, this is easy to understand. Just like Qin Shihuang's Unified Text and currency. Only with a unified standard can it be widely used. For a development team, using this pseudo code makes it easy for others to understand their own ideas or ideas. But for individuals (if they only want to come to OJ to do a question), they feel that they can ignore these so-called rules, but simply express their ideas for solving problems clearly, you can understand it yourself.
★Benefits of pseudocode
Pseudocode has a clear idea of how to solve the problem. After the problem is analyzed, some solutions will be made. After these ideas are clearly expressed using pseudocode, the code will continue based on this idea. At the same time, they will also inspire their own ideas and think of a variety of solutions to the problem.
★Instance analysis
Analyze a very simple question.
Question: output all the four-digit full numbers (that is, the first two digits are equal, and the last two digits are equal) in the form of AABB)
From the question, we can know that AABB is a four-digit number, so! = 0, but B can be = 0. Then, it is easy to get the following idea:
For (A = 1; A <10; A ++) {for (B = 0; B <10; B ++) {If (AABB is the total number of bytes) printf ("% d", AABB );}}
Here, there are two small issues: the first is how the number of AABB is expressed, and the second is how the sentence "AABB is a full number of partitions" is expressed. If you solve these two problems, this program will solve them!