31.07.2015 Views

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

STAGE II7SENIOR DIVISION182. Code of the Safe. It is known that code of the safe lock is a natural numberconsisting of n digits. The remainders are also known:– when dividing the code by 5.– when dividing the code by 7.– when dividing the code by 11.Unfortunately, this information is not enough to determine the code unambiguously.Task. Write an algorithm to calculate how many different numbers could be thecode of the safe’s lock and output the smallest of them.Input. Input data consists of four natural numbers written in one line and separated bya single space characters. The number of digits n (2 ≤ n ≤ 9) of the code is written firstly,then the remainders obtained when dividing the code by 5, by 7 and by 11 are given.183. The Product of Numbers in the Diagonals. Assume an n×n table containsnatural numbers. You should check if the products of the numbers on the main diagonalsof the table are equal. If not, find the largest quadratic table (part of the given table) thatwould satisfy this condition. If there can be several such tables, find any one of them.Note. Table having size 1×1 can also be a solution.Input. The first line of the input file contains the size of table n (2 ≤ n ≤ 8) and theremaining n lines contain the table itself. The table is such that the product of numbersin any diagonal of the table does not exceed maxlongint.Output. The largest quadratic table satisfying the condition or the message PROD-UCTS ARE EQUAL must be written to the output file.Example 1 Example 2Input Output Comments Input Output Comments4 5 6 PRODUCTS 4×3×3 = 2 1 1 2 1 2×1×3=6≠1 3 2 ARE 6×3×2 2 1 4 2 1 1=1×1×12 7 3 EQUAL 1 7 3 2×1=2×1184. Koch’s Quadric Island. Koch’s quadric island of the first degree containsquadrate (pict. 184.1).Koch’s Quadric Island of n’th degree is obtained by changingeach horizontal segment of the (n-1)’th degree curve into the followingbroken-line (pict. 184.2).And by changing each vertical segment into the following broken-line(pict. 184.3).Picture 184.1

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

Saved successfully!

Ooh no, something went wrong!