The name of the file will be read from the keyboard. The input file
contains on the first
line n and m , the size of the paper, separated by space and on
the next n
lines m positive integers which represent the heights.
The output file will be named map.out and will contain :
on the first line the message "Maximum area" followed by the maximum
value of the area
on the second line the message "Height" followed by the value of the
common height of the
determined area
on the third line the codes of the foldings
or
the message "Bad luck", if there is no solution.
Example:
For the input file :
3 4
1 1 1 1
2 2 2 2
2 2 2 2
The output file will contain the message "Bad luck"
for the input file :
4 4
1 1 1 1
2 1 3 4
1 2 3 4
2 2 2 2
The output file :
Maximum area 4
Height 1
H2U H1U
or
Maximum area 4
Height 2
H3D H4D
Attention ! If there are several solutions, only one will be printed !
prof. Emanuela Mateescu
"Grigore Moisil" Highschool, Iasi
2nd Problem: Contest (45 points)
Considering the points of an infinite array of triangles, like the
following ones:
Groups of these points make the vertexes of some geometrical figures.
For example:
{1,2,3} and {7,9,11} are the vertexes of triangles;
{11,13,26,24} and {2,7,9,18} are the vertexes of parallelograms;
{4,5,9,13,12,7} and {8,10,17,21,32,34} are the vertexes of hexagons.
Make a program which reads several sets of dates, analyses them and decides
wether the points are the vertexes of geometrical figures:triangle,
parallelogram or hexagon.
For obtaining a correct figure, it has to fulfil the conditions:
1. each side to coincide with a side of the array
2. the sides of the figures to be equal
The information will be read from the file "input" which containes
several sets of
dates, each set on a line.There are 6 numbers on a line at most, between 1 and
32767.
The result is printed in the file "output" and consists of: the
reading of the numbers followed by the result of the analyse.
Example :
File "input":
1 2 3
11 13 29 31
26 11 13 24
4 5 9 13 12 7
1 2 3 4 5
47
11 13 23 25
File "output":
1 2 3 are the vertexes of a triangle;
11 13 29 31 are not the vertexes of a convenient figure;
26 11 13 24 are the vertexes of a parallelogram;
4 5 9 13 12 7 are the vertexes of a hexagon;
1 2 3 4 5 are not the vertexes of a convenient figure;
47 are not the vertexes of a convenient figure;
11 13 23 25 are not the vertexes of a convenient figure.
ACM contest 1991
[Index]
[Important Informations]
[Participants]
[3rd Round]
[5th Round]