[The last few days] How to control points gracefully in the Blue Bridge Cup

How to control points gracefully in the Blue Bridge Cup

Video explanation: https://www.bilibili.com/video/BV1P34y1x75N/

1. Fill in the blanks

For fill-in-the-blank questions, we don't necessarily need to write code. We can use other tools such 计算器as , 日历, Excel, word, and pythonso on. To take a step back, if we want to write code, then we don't need to write a correct solution or low-complexity code. , we only need this code to run in the game, that is, the complexity can be 1 0 10 10^{10}10Within 10 , then a lot of violent practices can come in handy. Let’s take a step back and say that if you really can’t do the fill-in-the-blank questions, then you can count them by hand.Sometimes this is also a good choice.

If you have extra time or you are not sure whether the value calculated by the tool is accurate, you can also write code to continuously check the calculation, and make sure that the scores of the fill-in-the-blank questions you deserve are not lost.

2. Programming questions

2.1return 0;

The end of the mainfunction must be, return 0otherwise there is no point!

2.2 Code writing habits

Personal advice, functional programming

After reading the question for the first time, no matter what, write the violent code first ! , and then encapsulate the violent code into a slove()function, and after writing the violent code of all the topics, we start to think about the correct solution code. At this time, the benefits of the violent code come:

  • First of all, we ensured that we got the violence score for each question.
  • Secondly, when we write the positive solution code, it can be used to match the data to prevent the positive solution code from not even scoring the violent code.
  • And because we encapsulate the violent code in a function, mainthe overall logic of our function will not be confused

In fact, this programming method is to write the core code just like leetcodethe title of

2.3 Multi-shot multi-picture

When we analyze the topic, we must write more on the paper or on the drawing board of the computer, and discuss the topic in points. The analysis of the topic is very helpful. Wrong!

2.4 Matching data

When we test the written program, we must not only test the samples given, we must try some more extreme data, such as the largest data and the smallest data , otherwise your code may only be able to pass this problem. Example, the final score is 0

2.5 Others

  • Comes with mouse and keyboard, can improve the feel

  • It is recommended that some variables, arrays, tags, etc. be defined globally, so that initialization is avoided, because variables placed in the global are automatically initialized to 0 by the system, otherwise it will cause random assignment to you and cause the program to find problems for a long time.

  • Do cinnot scanfmix with and etc. It is recommended to use C语言the input and output of , which is not only fast, but also easy to debug

  • Looking at the data range, it feels like more than 1 0 9 10^9109 Please be sure to uselong longto prevent data overflow. Many students wrote the code correctly, but data overflow can only get a small fraction of the points, so不开long long见祖宗

  • Regarding the universal header #include <bits/stdc++.h>, this will only increase the compilation time and will not improve the evaluation time, so it will not affect the running speed of the code, but I personally feel that the universal header should be used less, unless the commonly used header files are remembered.

3. IDE and environment

IDEBecause Devcpp 5.4.0this version is used in the game, familiarizing with IDEthe and setting IDEit will definitely make us more comfortable in

The first is about debugging: Generally speaking IDE, the debugging needs to be opened by yourself:

  • Tools->Compile Options->Code Generation/Optimization->Code Generation->Optimization Level: set tolow

  • Tools->Compile Options->Code Generation/Optimization->Code Generation->Language Standard: set toGNU C++11

  • Tools->Compile Options->Code Generation/Optimization->Linker->Generate Debug Info: set toYes

There is also a APImanual . Generally speaking, it is relatively tasteless, because those who know don't need to read it, and those who don't know what to read. In fact, APIwe can focus on two places in this manual:

  • STL part, such as how the iterator is written, and what functions can be called by the container
  • C++ Strings This library may be used to get some useful functions

In fact, you should be familiar STLwith common containers and #include <algorithm>common functions of header files.
Here is a list of questions (with supporting videos and explanations):

http://acm.mangata.ltd/training/61cff0d9aa36161f3c11f143

4. Approaching the game

  • Adjust the work and rest time. The competition is held in the 9:00-13:00morning , and the whole time is 4 hours. For some households who often stay up late and have difficulty getting up, it is very important to adjust the work and rest in advance to leave plenty of energy for the official competition.

  • Drink less water, and use the toilet less during competitions

  • Keep a good attitude, do a few questions every day (don't do difficult problems), keep your hand feeling, and improve your confidence

  • Eat and drink well (

Finally, attach the blue bridge cup real question list:

http://acm.mangata.ltd/training/61d07ff9aa36161f3c122f0f

Guess you like

Origin blog.csdn.net/m0_46201544/article/details/124018887