
Exercises and problems in Informatics April 2002 
I. 22. A pack of N cards is placed on the verge of a
table in such a way that the upper cards are gradually shifted away
from the table to the greatest possible extent such that the pack
still keeps its balance.
Write a program (I22.PAS) which, for a given number of cards,
computes the distance between the righthand side of the uppermost
card and the verge of the table. The cards are assumed to have unit
size. (10 points)
I. 23. We model the growth of a tree as follows. A trunk of
length H grows in the first time step, then two branches (with an
angle ALPHA between them and of length X times of the trunk) appear
symmetrically at the end of the trunk in the next time step. Each of
these grows then two new twigs (X times as long as the previous ones)
in the subsequent time steps, and so on.
   TREE(50,3)  TREE(50,6)  TREE(75,11)   TREE(75,13) 
Your program (I23.PAS, ...) should read the values of H, X, ALPHA
(in degrees), and the number of time steps, then draw the
corresponding tree. The figures represent trees with X=3/4 and
ALFA=60, further H and the number of time steps are (50,3), (50,6),
(75,11) and (75,13), respectively. (10 points)
I. 24. The railway line connecting Gotham and
Rockwell has 9 stations (together with both terminal
stations). Running times between adjacent stations are known. Two
trains depart from the terminal stations in the opposite
direction. Both trains stay for 1 minute at each station. Since
there is only one track between the stations, a train can not depart
until the other one coming from the opposite direction has arrived
(see page 235). (If they are to depart at the same time, the train
from Gotham has priority.)
Prepare your sheet (I24.XLS) which computes the departures and
arrivals for each station every time the road times (second row) and
departure times from both terminal stations (thick boxes) have been
changed. The solution should be given in
minutes. (10 points)
Send your solutions to the following email address:
Deadline: 13 May 2002
