31.07.2015 Views

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32Further interrogation let to determine that all five persons gave two true and onefalse evidence.Task. Determine from the given data of interrogation, who had stolen the wallet.Explain your solution.212. Draughts. We have rank of n (3≤n≤10) squares.Squares are numerated from 1 to n from left to right. There isa heap of draughts standing on each square (from 0 to 10draughts). It is allowed to swap to heaps of draughts if theyare in the neighboring squares.Task. Write a program to rearrange heaps of draughtsso that the heights of heaps (i.e. the number of draughts inthe heap) would be in non ascending order. The programshould output the number of moves and moves themselvesin the order of their performance. Move is indicated bythe numbers of squares of swapped heaps.For example, there are given 3 heaps. There are 2, 5and 4 draughts in them. It is possible to rearrange heapsof draughts within two moves. The possible output is:21 22 3Pictures 212.1 illustrate this example.1 2 3The given heaps1 2 3The second move is performed1 2 3The first move is performedPicture 212.1213. Ornament. The ornament consists of n××n black and white squares. Newornament is obtained by scrolling the given ornament in different directions. It ispossible to scroll to the left, to the right, upwards and downwards.When scrolling ornament to any side, all rows (columns) are scrolled over oneposition, and the outside row (column) is moved to the opposite side. Scrolling isillustrated in pictures presented below.Input. The first line of the input file contains the size of the ornament n (3≤n≤10).In the second line there is written a sequence of commands. The sequence of commandsconsists of letters K (to the left), D (to the right), V (upwards), A (down-The ornamentbefore scrollingThe ornamentscrolled upwardsThe ornamentscrolled downwardsPicture 213.1The ornamentscrolled to the leftThe ornamentscrolled to the right

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!