Description Sub-Xiao recently played in the Land of the Lord 1, he has a good evaluation of the game, combining FPS and RPG elements, can play very high. However, he found that a generation of mission system did not do well, the task system did not help him to figure out which area how many tasks, and, to the task, but also more scattered. For example, at a task point in the 1 area, you get 4 quests, 2 A task point in the area, and you get 3 quests; After a while, you get 1 quests in another task point in the 3 area (not completed before), 3 missions are received in the area of the region. He felt very messy, and now he's going to design a program to count the number of tasks in each area.
-
- Input
-
- Multiple sets of test data to enter 0 0 end
one row per group of data, input m area, n Tasks (0<m,n<100)
-
- Output
-
- output statistical results for each region (no sorting required)
-
- Sample input
-
-
1 32 33 41 70 0
-
- Sample output
-
1 102 33 4
1 Importjava.util.LinkedList;2 ImportJava.util.Scanner;3 4 Public classMain {5 Public Static voidMain (string[] args) {6Scanner scanner=NewScanner (system.in);7 String A;8 String B;9Linkedlist<string> position=NewLinkedlist<string>();TenLinkedlist<string> count=NewLinkedlist<string>(); One intindex; A String temp; - intNumber1; - intnumber2; the inti; - - while(true){ -A=Scanner.next (); +b=Scanner.next (); - + if(A.compareto ("0") ==0 && B.compareto ("0") ==0) A Break; at - if(Position.contains (a) = =false){ - Position.add (a); - Count.add (b); - } - Else{ inindex=Position.indexof (a); -temp=Count.get (index); to +number1=Integer.parseint (b); -Number2=Integer.parseint (temp); thenumber1=number1+number2; * Count.set (index,long.tostring (Number1)); $ }Panax Notoginseng } - the for(I=0;i<position.size (); i++){ +System.out.println (Position.get (i) + "" +Count.get (i)); A } the } +}
The Land of the Lord No 1