解题记录:程序设计六 实验六 题目三 The World Population Explosion

题目
In the past, when population grew, there was unexplored territory to inhabit. But now, almost all the habitable land has been explored. The world’s population may reach 8.7 billion in 2033. It is clear that world population is a serious issue that needs careful attention. Human beings are unique to solve problems through cultural evolution. Facing the world population explosion in the near future, we must carry out the birth control program in order to save the mankind and save the world. And now we have the population amount of some country of the world in last year and this year. your task is to differ the countries whose population is changed from the data below and sort them in descending order and return the changing value and names of those countries whose population amount are not changed as well.

输入
The input consists of only one test case, followed by 4 lines, the first line is a integer N indicating the amount of the countries, and then input last year’s and this year’s population amount of every country in the last two lines before the names of the countries is inputted in the second line.

输出
You should output the countries firstly whose population are changed followed by the rest of those whose population are unchanged. If the changes are the same between two countries, lexicographic order should be used in your code.

样例输入

7
USA CHINA JAPAN KOREA CUBA ARGENTINA PERU
100 200 150 50 9 2 22
120 240 140 10 9 2 12

样例输出

40 CHINA
20 USA
-10 JAPAN
-10 PERU
-40 KOREA
0 ARGENTINA
0 CUBA

题目链接:http://acm.swust.cn/#/problems/580/385?_k=kumzwp
我的代码:http://putpan.com/fs/554172c0a1e8a4d9263/


猜你喜欢

转载自blog.csdn.net/weixin_43751110/article/details/84309300
今日推荐