/* Constraintstime limit: 1 secs, memory limit: 32 mbdescription Chen is a gifted child. His dream is to become the greatest physician in the world. To this end, he wants to worship the most prestigious physicians nearby. In order to judge his qualifications, the physician gave him a difficult problem. The doctor took him to a cave where herbs were everywhere and said to him, "Child, there are some different herbs in this cave. It takes some time to pick every plant, each strain also has its own value. I will give you some time, during which you can collect some herbs. If you are a smart child, you should be able to maximize the total value of collected herbs ." If you are Chen, can you complete this task? The first line of input has two integers t (1 <= T <= 1000) and M (1 <= m <= 100), which are separated by a space, t represents the total time that can be used for medicine collection, and m represents the number of herbs in the cave. The next line of M contains two integers ranging from 1 to 100 (including 1 and 100), indicating the time to pick a particular herb and the value of this herb, respectively. The output includes one line. This line contains only one integer, indicating the maximum total value of herbs that can be acquired within the specified time. Sample input70 371 10069 11 2 Sample output3 */# include <iostream> # include <set> # include <vector> using namespace STD; typedef struct drug {int time; int price ;} drug; int main () {int T, M; CIN> T> m; vector <drug> data (m); For (INT I = 0; I <m; I ++) CIN> data [I]. time> data [I]. price; vector <int> OP (t + 1, 0); For (INT I = 0; I <m; I ++) {for (Int J = T; j> = data [I]. time; j --) // must start from the back to the front {If (j> = data [I]. time) OP [J] = max (OP [J], OP [J-data [I]. time] + data [I]. price) ;}} cout <op [T] <Endl ;}