1038 平方和排序


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

给出一些整数组,请编程每组整数,按各位数字的平方和的大小排序。其结构为:每组整数第一行只有一个整数N,表示后继有N个整数需要排序,若表示整数组的个数为0,表示输入结束。

Sample

Input

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

Output

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

Comments

There are no comments at the moment.