Scala 数组排序

2016-01-27· 1315 次浏览
## 代码 ```java import scala.io.StdIn import scala.util.Sorting object Solution { def main(args: Array[String]) { var N = StdIn.readInt() Sorting.stableSort(1 to N map (_ => StdIn.readInt())) foreach println } } ``` ## 示例输入 ``` 5 5 4 3 2 1 ``` ## 示例输出 ``` 1 2 3 4 5 ```