{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eAccording to Wikipedia, \"The Traveling Salesman Problem (TSP) is a problem in combinatorial optimization studied in operations research and theoretical computer science. Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. The problem was first formulated as a mathematical problem in 1930 and is one of the most intensively studied problems in optimization. It is used as a benchmark for many optimization methods. Even though the problem is computationally difficult, a large number of heuristics and exact methods are known, so that some instances with tens of thousands of cities can be solved.\"\u003c/p\u003e\r\n\u003cp\u003eFortunately, you won\u0027t have to solve TSP. You\u0027re working for a very clever traveling salesman who has already figured out the path he is going to take. All he needs from you is a quick way to figure out how far he traveled after every segment of his tour.\u003c/p\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eThe salesman kept detailed records of his travels. You\u0027ll be getting a series of lines of the form \"Some text (X, Y).\" indicating that the salesman has been at the point X kilometers east and Y kilometers north of the origin of a Cartesian plane.\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each segment of the trip, output the total distance traveled up to that point as a line in the format \"The salesman has traveled a total of D kilometers.\" Show three digits after the decimal point when printing D. Note that the salesman only travels in straight lines (even after a couple of drinks).\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eI started out at (0, 5).\r\nThen I traveled to (3.7, 5).\r\nAfter a couple of drinks I wobbled to (2.7, 4).\r\nThe next morning I woke up near (4, 3).\r\nI finished my journey in (-.2, 8).\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eThe salesman has traveled a total of 3.700 kilometers.\r\nThe salesman has traveled a total of 5.114 kilometers.\r\nThe salesman has traveled a total of 6.754 kilometers.\r\nThe salesman has traveled a total of 13.284 kilometers.\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}