模拟
Simulation, as the name implies, is the method that computers use to simulate the operations required in the problem. Similar to NOIP 2014's [Big Bang version rock paper scissors] (https://uoj.ac/problem/15) (original link in Chinese), coding according to the problem description would be fine.
Of course, simulations are not always easy to write. See classic problems like [World of Warcraft] (http://bailian.openjudge.cn/practice/3750/) and [pig kingdom kill] (https://loj.ac/problem /2885) for reference.
Simulation problems usually have large code size, many operations, and complicated logics. And because of its large amount of code, the debugging process is really difficult. Therefore, it would be quite time-consuming if you made mistakes during contests.
Therefore, for simulation problems, the following suggestions below may help you improve the speed:
- Before writing the code, write down the process of your implementation on scratch paper as complete as possible;
- In the code, try to modularize each part as a function, structure, or class;
- For some concepts that may be reused, they can be transformed in a unified way so they are easier to handle: for example, if a problem gives you "YY-MM-DD hour:minute", processing it in a function into seconds format will help reduce confusion;
- When debugging, debug in blocks. The advantage of modularity is that it is convenient to adjust a certain part separately;
- When writing the code, think clearly. Do not think intuitively, instead, follow the steps you have written on the scratch paper.
In fact, the above steps are also very helpful in solving other types of problems.
build本页面最近更新:,更新历史
edit发现错误?想一起完善? 在 GitHub 上编辑此页!
people本页面贡献者:OI-wiki
copyright本页面的全部内容在 CC BY-SA 4.0 和 SATA 协议之条款下提供,附加条款亦可能应用