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