Add up the lengths of the axis-aligned wall segments and report the total work hours split across the workers, rounded up.
Easy2MathImplementationInterviewNo attempts yetTime limit1sMemory limit256 MBOne of the images people remember from German reunification is the wall between East and West Berlin coming down. Pieces of brick from that wall now sit in museums and private collections. Many of the pieces sold to tourists at high prices cannot be shown to have ever been part of the wall.
In 1987 President Reagan asked the Soviet Union to open East Germany to the West with the line "Mr. Gorbachev, tear down this wall!". The wall was long and sturdy, so Mr. Gorbachev alone would have needed a very long time, and he would have called in a few helpers. Compute how long it takes all of them together to tear the whole wall down.
The wall is given as a sequence of points in a 2-D coordinate system. All coordinates are integers, and every piece of wall is horizontal or vertical, never at an angle. You are also given how long one person needs to tear down one meter of wall, and how many people are working.
The first line contains the number K of data sets. The K data sets follow, each in this form.
The first line of a data set contains three integers n, s, p. Here 1≤n≤1000 is the number of straight-line segments in the wall, 0<s<100 is the number of hours one person needs to tear down one meter of wall, and 1≤p≤1000 is the number of people tearing down the wall.
Then follow n+1 lines, each containing two integers xi, yi with −10000≤xi,yi≤10000. This is the i-th point describing the wall, and the i-th segment runs from (xi,yi) to (xi+1,yi+1). Every piece of wall is horizontal or vertical, so for each i either xi+1=xi or yi+1=yi. The wall never crosses itself.
For each data set, print Data Set x: on a line of its own, where x is the number of the data set, counting from 1.
On the next line print the number of hours the p people need to tear down the entire wall, rounded up to the nearest integer. If the work takes 3.1 hours, print 4, not 3.
Print a blank line after each data set.