#T491. 统计数字
统计数字
Description
During a scientific research survey, n natural numbers were obtained, each not exceeding 1,500,000,000 (1.5 × 109). It is known that the number of distinct values does not exceed 10,000. The task is to count the occurrences of each natural number and output the results in ascending order of the natural numbers.
Input Format
The input consists of n+1 lines:
Line 1 contains an integer n, representing the number of natural numbers.
Lines 2 to n+1 each contain one natural number.
Output Format
The output consists of m lines (where m is the number of distinct natural numbers in the input), sorted in ascending order of the natural numbers. Each line outputs two integers: the natural number and its occurrence count, separated by a space.
【Data Range】
40% of data satisfies: 1<=n<=1000
80% of data satisfies: 1<=n<=50000
100% of data satisfies: 1<=n<=200000, each number does not exceed 1,500,000,000 (1.5*109)
CodesOnlineSource