Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.77 KB | None | 0 0
  1.     """
  2. distance(529,1000,528,994,475,670):  0.9863939238321064
  3. distance(529,1000,528,994,443,533):  8.05555037796247
  4. distance(529,1000,528,994,495,812):  2.6303837968857167
  5. distance(862,1000,864,992,891,883):  0.24253562503633297
  6. distance(806,10,804,15,519,747):  7.242118188905044
  7. distance(806,10,804,15,627,478):  7.613508865259127
  8. distance(807,1000,809,991,913,485):  8.243357397108934
  9.    """.trimIndent()
  10.             .split("\n")
  11.             .map { it.substring(0,it.indexOf("):")) }
  12.             .map { it.substring(it.indexOf("(") + 1)}
  13.             .map { it.split(",").map { Integer.parseInt(it) } }
  14.             .map { it.fold("distance(") {a,b -> if(a == "") b.toString() else "$a,$b" }+ "):  " + distance(*it.toIntArray()) }
  15.             .forEach(System.out::println)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement