Age Sort

作者: dqvpnrlww 分类: 算法与数据结构 发布时间: 2014-10-24 23:43 阅读: 1,826
中文题解请访问我的博客 :


You are given the ages (in years) of all people of a country with at least 1 year of age. You know that no individual in that country lives for 100 or more years. Now, you are given a very simple task of sorting all the ages in ascending order.


There are multiple test cases in the input file. Each case starts with an integer (0<n<=2000000), the total number of people. In the next line, there are integers indicating the ages. Input is terminated
with a case where = 0. This case should not be processed.



For each case, print a line with space separated integers. These integers are the ages of that country sorted in ascending order.


Warning: Input Data is pretty big (~  25 MB) so use faster IO.


Sample Input                             Output for Sample Input


3 4 2 1 5


2 3 2 3 1


1 2 3 4 5

1 2 2 3 3

Note: The memory limit of this problem is 2 Megabyte Only.

Problem Setter: Mohammad Mahmudur Rahman

Special Thanks: Shahriar Manzoor


This article is automatically posted by WP-AutoPost : WordPress自动采集发布插件



电子邮件地址不会被公开。 必填项已用*标注