PROGRAMMING:Program and product dog
In a company, programmers often have a bunch of todolings to do, and these todolings are assigned to them by product managers. But when programmers encounter product dogs that don't understand technology, it's a tragedy. Product managers often modify their todo list, such as adding or reducing their todo list.
Please design a codemonkey class to represent program manager and another productdog class to represent product manager.
The codemonkey class has private members name and todolist.
The constructor initializes the name and todolist, and the public function int sizeof_ Todolist (), from the friend function add of productdog class_ todolist(CodeMonkey&,int),reduce_ todolist(CodeMonkey& , int);
The productdog class has the public function add_ todolist(CodeMonkey&,int),reduce_ todolist(CodeMonkey& , int)
Input Specification
Each test file contains a set of test cases. For each test case, the first line of input n (1 < = n < = 10 ^ 6) means that there are n programmers, and the next N lines, each line: name x means that the length of todolist of the programmer named name is X. The next line m (1 < = m < = 10 ^ 6) indicates the number of times the product manager assigned tasks. Next, m lines, each line name opt x, opt = 0 means that the todolist of the program named name increases x, opt = 1 means that it decreases X. Input data to ensure the legitimacy.
Output Specification
For each programmer, output name x, where x is the length of the final todolist. Output in input order.
Sample Input:
three
Jack 1
Luck 2
Tom 3
four
Tom 0 100
Luck 0 50
Jack 0 25
Tom 1 50
Sample Output:
Jack 26
Luck 52
Tom 53
answer:If there is no answer, please comment
Please design a codemonkey class to represent program manager and another productdog class to represent product manager.
The codemonkey class has private members name and todolist.
The constructor initializes the name and todolist, and the public function int sizeof_ Todolist (), from the friend function add of productdog class_ todolist(CodeMonkey&,int),reduce_ todolist(CodeMonkey& , int);
The productdog class has the public function add_ todolist(CodeMonkey&,int),reduce_ todolist(CodeMonkey& , int)
Input Specification
Each test file contains a set of test cases. For each test case, the first line of input n (1 < = n < = 10 ^ 6) means that there are n programmers, and the next N lines, each line: name x means that the length of todolist of the programmer named name is X. The next line m (1 < = m < = 10 ^ 6) indicates the number of times the product manager assigned tasks. Next, m lines, each line name opt x, opt = 0 means that the todolist of the program named name increases x, opt = 1 means that it decreases X. Input data to ensure the legitimacy.
Output Specification
For each programmer, output name x, where x is the length of the final todolist. Output in input order.
Sample Input:
three
Jack 1
Luck 2
Tom 3
four
Tom 0 100
Luck 0 50
Jack 0 25
Tom 1 50
Sample Output:
Jack 26
Luck 52
Tom 53
answer:If there is no answer, please comment