|
Length of path in coordinate system !
|
|
06-21-2009, 07:13 PM
(This post was last modified: 12-21-2009 02:54 AM by drdebcol.)
Post: #1
|
|||
|
|||
|
Length of path in coordinate system !
Here is one mathematical problem ! It was on some competitions in programming !
You need to find path between dots in coordinate system ! If you have n dots and every dot has it's coordinates x and y ! First you need to have formula for finding length of path between two dots ! It is Euclid formula or Euclidean distance, look at the picture : ![]() And i wrote that in Pascal as function : Code: function length_between_two_dots(x1,y1,x2,y2:integer):real;And you just need to find sum of those paths ! Number of paths is number_of_dots-1 ! or n-1 ! Because of that i made this loop : Code: for i:=1 to n-1 doCode: program length_in_system;There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
« Next Oldest | Next Newest »
|



![[Image: formula_coordinate.jpg]](http://www.pro9ramming.com/pictures/formula_coordinate.jpg)


