The Land of the Lord No 1

Source: Internet
Author: User

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

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.