fun readInt () = valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn) fun readLargeInt () = valOf (TextIO.scanStream (LargeInt.scan StringCvt.DEC) TextIO.stdIn) fun printList [] = print "\n" | printList [x] = ( print (LargeInt.toString x); printList [] ) | printList (h :: tl) = ( print (LargeInt.toString h); print " "; printList tl ) fun printAns [] = ignore () | printAns (h :: tl) = ( printList h; printAns tl ) val () = let val t = readInt () val cases = List.tabulate (t, fn _ => let val d = readInt() val a = readLargeInt() val x_s = List.tabulate (d, fn _ => readLargeInt()) in (d, a, x_s) end ) val ans = List.map (fn (d, a, x_s) => List.map (fn x => Real.toLargeInt IEEEReal.TO_NEAREST ((Real.fromLargeInt x) / (Real.fromLargeInt a))) x_s) cases in printAns ans end