| Move minimal number of matches to obtain a symmetric figure. | |
|---|---|
Complexity (1-100): 35
N matches on a plane constitute a figure (N≤15). A figure A is symmetric to figure B iff there exists an axis of symmetry such that B can be obtained by flipping A around that axis. Obviously, each figure can be flipped by moving its matches. Matches cannot be broken, but can be put one on another. Write a program flipping a figure by moving minimal number of matches. Input data is stored in a file containing N in the first line, then N lines each containing space-separated coordinates of matches ends (x1, y1) - (x2, y2) of figure A. The program should output 1) a number of moved matches and 2) N lines containing coordinates of matches in the symmetric figure B. Example: INPUT.TXT OUTPUT Notes. All coordinates are integer. The program is allowed to run no longer than 1 sec. |
|
| Solution: | solution.pas |
Book of programming problems is powered by UseBB 1 Forum Software | Contact Admin