Problem 77 Greedy Gift Givers

xiaoxiao2021-03-05  22

Like Problem 108, ROB simplifies this problem, removes BT test data, and defines the problem within a small range, up to 10 people, no more than 14 letters, the gift value is within 2000, but this is OK Unlike Problem 108, the first two values ​​have no effect on the entire problem, even if the BT data is used, it is just a small trick (because it is impossible to modify the name, get a little meaning of a few thousand letters, no one, In addition to adding the difficulty of saving, and the algorithm is independent, not the purpose of USACO, and if you use CPP, there is STL, this problem does not affect the program at all. So, pay attention to the problem itself, don't attract it to the second place. I guess that Rob must receive a lot of COMPLAINTS in this area, 嘿嘿

The description of this topic was not very clear. The current version of Rob explained many small details. For example, the problem of integer division, I was in the first time, I was depressed, I clear DAVE for 200 received 500, and finally how to be 302. Because everyone's implementation is different, some people's code will not encounter this problem. In fact, USaco's topic is sometimes not difficult, but many small details are not ignored when encoding, or will not be uncomfortable. (Because the first submission will be a bit different, although I am a rookie, I will always pass it once, but because this kind of non-confusing mistake can not pass, the feeling is really not Two words can be described in @ _ #).

Originally, it was implemented in Map, it's simple, but Map is too enthusiastic, it will automatically sort, and Rob requires you the same time when you output it. E ~~~ -_-! In fact, I want to change to Vector > should be it. However, killing chicken is used with a cow knife, and the efficiency is not higher than Array. It is also necessary to play a few lines of code, and will sacrifice the Array Dafa and directly use the array. The only thing that is troublesome than Map is to write a function of a checkered name, and it is not like MAP to directly Key / Value.

Finally, let's say that one is not a detailed question (but Detail ...), in fact, in the sample data it gives: Vick. This guy is a mess, only knows that I don't know. What did you think of? Yes, he doesn't mean that I have to except 0 when I am in a flat gift! Be careful, comrades. Trap ~~~! Then why some people can't meet and I have encountered it. Look at my code, I will calculate the average of you want to allocate. If you forget Check, ask you to give you a stuffy stick when you submit it. If this division is placed in the back for Loop, you can avoid this problem. Originally, I hope I don't want to repeat labor. As a result, I will do bad things, I should have the "premature optimization is the root of all eviL." Ah

转载请注明原文地址:https://www.9cbs.com/read-32705.html

New Post(0)