2018 Java Chapter 7 (Week 07)

From: 2018-09-01 00:00:00 To: 2018-11-20 00:00:00 Now: 2024-05-03 15:44:42 Status: Public

B - 숫자빈도

Time Limit: 1s Memory Limit: 128MB

Submissions: 840 Solved: 494
Description

-100부터 100사이의 정수들을 입력받아 각 숫자별로 몇번 나타났는지 오름차순으로 개수를 출력하는 프로그램을 만드세요. 

Write a program that reads the integers between -100 and 100 and counts the occurrences of each with ascending order. 

Input

* Line 1 : 숫자의 개수 N (1~10,000)

* Line 2 ~ N+1 : 정수 (-100~100)

 

Output

* Line 1 ~ M :공백으로 구분하여 정수와 개수를 출력

 - M은 중복되지 않은 정수의 개수

 

Sample Input
5
-3
100
-1
-2
-1
Sample Output
-3 1
-2 1
-1 2
100 1
Source

JAVA2015 PE7.3