Proper hints for the the test cases out there

Posted by

samio 21 Feb 2020 01:27

Well, you have to know how to determine the distance between two points first.

It can be calculated by, dis = sqrt((x1-x2)^2+(y1-y2)^2).

You can say that, we can just calculate the distance in between the points but why the raidius of the nails are given. Its because the rope is wrapped around each and every nails. But the rope is not in fully contact with nails. The more nails we get, the less contact we have in between rope and nails.

The amount of which the rope is in contact with nail is : s = parameter of a nail/the number of nails.

So we are just required to print out : d(d is the sum of the distance between them) + number of nails * s(s is the amount which the rope is in contact with nails)

If you have problem understanding my word or for better understanding, give this a go : https://ideone.com/t1M3rK

*Edited by author 21.02.2020 01:31*