- Problem Statement.
- A
**main()**with the examples compiled in. - A skeleton that compiles with
**main.cpp**. -
**Problem Given in Topcoder**: July, 2016 -
**Competitors who opened the problem**: 407 -
**Competitors who submitted a solution**: 378 -
**Number of correct solutions**: 351 -
**Accuracy (percentage correct vs those who opened)**: 86.2% -
**Average Correct Time**: 14 minutes, 39 seconds.

While you're doing that, you should maintain the *(x,y)*
coordinate of the bear after each segment. You do that by adding or subtracting
**a[i]** from the bear's *x* or *y* coordinate, depending on the value
of **dir[i]**.
Finally, you use the
distance formula to calculate the bear's distance to the origin. Add the to the total
and return the total.

In example 0, the Bear's final *(x,y)* coordinate is (3,-2), so his distance
to the origin is *sqrt( (-2)*(-2) + (3*3) )* = 3.6055512755, and his final
distance is 10.6055512755.