1508 叉积和排序


Submit solution

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

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

Description

将一些正整数按叉积和排序后输出. 所谓叉积和,是指把整数各位乘以位数相加,例如:13倒置成了12+31=5。

Input

第一行的整数N表示后面列出的组数。每组数的第一个整数n表示后面将有n个整数。(每组数据量不超80)

Output

按叉积和从小到大排序后输出,一样大就按原始数据从小到大排序,行末无空格. .

Sample

Input

1
4 83 13 24 36

Output

13 24 36 83

Source: zjut_ZSF


Comments

There are no comments at the moment.