## Exercises and problems in Informatics |

## Please read The Rules of the Problem Solving Competition.

### New exercises of sign I

**I. 94.** Let us experiment with plane curves.

Write a program that has a real number *a* as its input, then displays the plane curve with equation (*x*^{2}+*y*^{2})^{2}=(*x*+*ay*)*x*^{2}. Pay attention to the nice visualization. In demo mode, your program should give some examples of ``interesting'' values of the parameter *a*.

Your program (i94.pas) is to be submitted.
(*10 points*)

**I. 95.** We are given a connected network of computers consisting of nodes and cables connecting two nodes. We want to make this network more secure such that it still remains connected if any of the cables (but only one of them!) breaks away. Determine those pairs of nodes - minimal in number - such that connecting them makes the network more secure in the above sense.

Every node is represented by a positive integer. Your program should read the pairs of numbers representing pairs of nodes. Each line of the input will consists of two positive integers separated by a space. The end of the input is indicated by two zeros, also separated by a space. Your program should display the pairs of nodes to be connected in the same format.

It is important that solutions will be checked by a computer program, so your program should not display anything else and should not make the output scrollable. (Hint: For testing purposes, your program can redirect *stdin*.)

Your program (i95.pas) is to be submitted.
(*10 points*)

**I. 96.** The first *n* terms of a sequence do not specify the rest: in general, any number can stand at the (*n*+1)-th place.

We now give the following rule to determine the (*n*+1)-th term (supposing that *n* \(\displaystyle \ge\)2 is an integer and the first *n* terms of the sequence are already given):

The difference of consecutive terms are formed (that is the term with smaller index is subtracted from the one with larger index). Then we do the same operation on the difference sequence just obtained, and repeat the procedure again. After a few steps we arrive at a constant sequence with all terms equal: this will surely happen at most in the (*n*-1)-th step, since this time the sequence consists of only one term. For two examples, see the numbers in bold face in the table:

Your task is to find the (*n*+1)-th term of the original sequence such that forming difference sequences from the beginning will yield the same constant sequence. (See the thinner numbers at the rightmost columns in the example.)

Prepare a sheet (i96.xls) that constructs the (*n*+1)-th term of the sequence, if the first *n* terms are given, using the rule above.

Your sheet (i96.xls) is to be submitted. Remarks about its usage may be entered into cell `A1`.
(*10 points*)

Our contestants are kindly asked to comply with the requirements given in the 2004 September issue of our Journal concerning the format (remarks, data, etc.) of your submitted works.

### Send your solutions by e-mail to: i@komal.hu

### New problem of sign S

**S. 5.** Write a program to draw Escher-like hypebolic tilings. Decompose Poincaré's disc model into triangles and draw the same pattern into each tile. The input consists of

*p*,

*q*,

*r*are positive integers such that \(\displaystyle \frac1p+ \frac1q+\frac1r<1\). Draw the starting triangle

*ABC*such that

*A*lies in the centre of the model and

*B*is drawn right to (see the

*Figure,*the subscriptions are ``Modell'' and ``Pattern'').

*m*, at most 2048.

The program gets the data as command-line parameters in the following:

`(program)` *p* *q* *r* `pattern.ppm` *a*_{1} *a*_{2} *b*_{1} *b*_{2} *c*_{1} *c*_{2} `output.ppm` *m*

(*10 points*)