We have a board of size n*n, where 3 <= n <=20, and the fields
counted from 1 to n*n. In the corners there are two white knights,respectively
two
black knights.
Change the places of the black knights with the white ones with a minimum
number
of moves. The move of the knights is alternative.
---------------------- |1 |2 | 3 | | o | | o | | | | | ---------------------- |4 |5 |6 | | | | | | | | | ---------------------- |7 |8 |9 | | * | | * | | | | | ----------------------
n = 3the file "solution":
o * o * 1-6 7-2 3-8 9-4 6-7 2-9 8-1 4-3 7-2 9-4 1-6 3-8 2-9 4-3 6-7 8-1 16Maximum time for test for a number n , 15" for 386 at 33MHz.
Having n (3<= n <=100) points in plane, find out three of them which make a triangle which containes the maximum number of points from the ones left.
The informations are read from the file "trdate", having the following stucture:
n x1 y1 x2 y2 ..... xn ynwhere n is the number of points, and xi, yi the coordonates of the points.
a b c d e f pwhere (a,b), (c,d), (e,f) are the coordonates of the vertexes of the triangle, and p the number of points situated in the interior of the triangle. A point situated on a side of the triangle is considered being in interior.
Having an expression :
op nr_1 nr_2 ... nr_n = resultwhere:
+ 23 17 = 49 23 may be considered in the sum as 23 or 32 17 may be considered in the sum as 17 or 71The solution is:
+ 32 17 = 49The dates are read from the file "ardat" having the following structure:
op nr_1 nr_2 ... nr_n = resultAttention! There can be more sets of dates in the file "ardat" !!! The solution will be written in a file "arsol" having the following structure:
op the n numbers in the right format = resultAttention! If the input file contains more sets of dates, in the file "arsol" there will be several lines, corresponding to each set.
"ardat" + 23 17 = 49 "arsol" + 32 17 = 49In case there is no solution, print in the file the message
There is no solution.