题解 | #明明的随机数#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
import scala.collection.mutable
import scala.io.StdIn
import scala.util.Random
object Main {
def main(args: Array[String]): Unit = {
val i: Int = StdIn.readInt()
val random = new Random
val set = mutable.Set[Int]()
for (elem <- 1 to i) {
set.add(StdIn.readInt())
// set.add(random.nextInt(i)+1)
}
set.toList.sorted.foreach(println)
}
}