Problem K: 21-vector-平方和排序

Problem K: 21-vector-平方和排序

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 72  Solved: 35
[Submit] [Status] [Web Board] [Creator:]

Description

给出一些整数组,请编程每组整数,按各位数字的平方和的大小排序。

Input

每组整数第一行只有一个整数N,表示后继有N个整数需要排序,若表示整数组的个数为0,表示输入结束。

Output

输出排序结果

Sample Input

9
12 567 91 33 657 812 2221 3 77
5
1 3 11 33 9
0

Sample Output

12 3 2221 33 812 91 77 567 657 
1 11 3 33 9

[Submit][Status]