Trick (various traps and pitfalls) that once hated me but helped me grow)

Source: Internet
Author: User

The color is updated recently.

1. (5.12 Ningbo engineering college competition) a matrix of N * m is given and then operated. This often happens when you search for questions. The regular n indicates the number of rows, and the disgusting n indicates the number of columns.

2. (5.16 zoj 3181) because the answer is relatively large, if the remainder of a certain number is obtained, multiplication or addition is easy to exceed 32-bit int, replace it with a 64-bit int where it is easy to cross-border, otherwise, the answer is set to _ int64 or long.

3. (5.18 zoj 3395) the number of string repetitions required by the question is 1 to m, but when the suffix array is used to solve the problem, it is determined that the number of times is 1.

4. (5.19 xtu 1143) when the number of nodes in the M-fork Harman tree n does not meet the requirements of N % (m-1) = 1% m-1), it should be supplemented with 0, in this way, we can correctly construct the Harman tree. When n = 1, we need to make a special decision. pay more attention to the remainder.

5. (5.19 xtu 1146) marital matching problems that cannot be separated, cannot be solved using regular stable marriage algorithms, and must be greedy. You should first choose the least favorite and then choose the desired update.

6. (5.20 poj 1625) some strings used to create the dictionary tree are other strings, therefore, add this-> flag | = This-> fail-> flag when transforming the trie diagram.

7. (5.20 poj 1625) When making a high-precision question, the final answer may be 0. Because the high-precision is easy to ignore 0, it is necessary to consider whether a special decision is required.

8. (5.20 poj 1625) The entered ASCII code must be greater than 32 characters, which may contain spaces. scanf may cause errors. The entered string must be determined whether it contains spaces.

9. (5.23 HDU 3117) The question requires that the output is the last four digits after the remainder of the Fibonacci, which may be less than four digits. It should be supplemented with 0, that is, printf ("% 04d \ n", ANS % 10000 );

10. (5.27 HDU 3535) the problem must be solved with a backpack. The capacity subscript of a conventional backpack starts from 1. 0 indicates the initial state, but the capacity of this problem may reach 0, the problem may be 0 in the future.

11. (6.05 poj 3181) the number of combined solutions should be output. The number of solutions may not only exceed 32-bit int, but also require high precision. Pay attention to the scope of the answers.

12. (6.08 HDU 2767) adding the least number of edges makes the source image become a strongly connected graph. When the strongly connected component is 1, it is determined that, because it can become a strongly connected graph without adding edges.

13. (7.05 UESTC 1558) Enter N and enter another string with spaces. Gets cannot be used in the middle of the string, because N may have multiple spaces.

14. (7.05 UESTC 1558) the macro definition of function min (A, B) is different from the normal call efficiency. Under normal circumstances, the macro definition efficiency is high, but when # define min (A, B) A <B? A: The function 'B' in 'B' is 'query () 'has a low aging rate.

15. (2874 HDU) define a variable as a global variable during deep search, and the result is lost during recursion.

16. (7.29 HDU 2242) when encountering the problem of dual-connected components, pay special attention to the situation of duplicate edges.

17. (8.1 CF 110 A) the question "any end of the string" is the end. I thought it was the end. I didn't expect it to be any endpoint. It was stuck for an hour and a half. When the question is stuck, the first thing I want to know is whether I have understood the question.

18. (8.3 HDU 1796) This question requires LCM and GCD, but the data will be mixed into 0. You must delete the data or make a special decision to avoid re.

19. (8.4 CF 107 d) Any its substring with length equal to K is a palindrome. It is a legal string when a string meets this condition, however, it is also valid if there are no substrings with a length of K.

20. (8.15 CF 103 d) the number of vertices or edges whose source distance is L. The same location on the edge may be counted twice, which requires special judgment.

21. (8.23 CF 96 E) give an operation sequence. F indicates moving forward, t indicates turning, and m times must be modified to the longest distance. M can be larger than N, but this is not allowed by my DP equation. I learned a skill.

The subscripts of the State are smaller than 0. If allowed, The subscripts of all states are increased by 100 or 200 or...

22. (9.21 poj 4025) use the prefix and suffix to construct a string. When the string is a single letter, it must be specially determined and cannot be composed of a prefix or suffix.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.