Toggle navigation
HUSTOJ
F.A.Qs
ProblemSet
Source/Category
Status
Ranklist
Contest
Login
Language
中文
ئۇيغۇرچە
English
فارسی
ไทย
한국어
Problem E: 排序(按末位数字排)
Problem E: 排序(按末位数字排)
[Creator :
]
Time Limit :
1.000
sec
Memory Limit :
128 MB
Solved: 43
Submit: 46
Statistics
Description
排序(按末位数字排)
按末位数字从小到大排,末位数字相同的,按原来的先后顺序排
Input
5 (n个正整数 1<=n<=1000000 )
5 42 32 21 12 (每个数小于1000000)
Output
21 42 32 12 5
Sample Input
Copy
4 12345 14 13 39
Sample Output
Copy
13 14 12345 39
HINT
n=int(input())
a=list(map(int,input().split()))
a.sort(key=lambda x:x%10)
for i in a:
print(i,end=" ")