Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 2 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Linear cellular automaton is an infinite sequence of cells, each holding either 0 or 1. Cells are indexed with integers, extending from some chosen "zero" cell in both positive and negative directions.
In the initial (first) state all except the finite number of cells contain 0. Next state is computed from previous one by a simple rule: new cell value is 1 if the cell had exactly one neighbour with value 1, otherwise 0.
Although computing states is easy and fast, researchers are often interested in states after very many steps. Because these states may occupy large amount of memory, only parts of them are usually printed.
Your program must, given the initial state, quickly find values for S-th state for cells with indexes F, F + 1, …, F + L − 1.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin, I. Ludov | |||
Input file: | input.txt | Time limit: | 2 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Young black-hat hacker Vasya routinely installs key loggers on every computer he can get his hands on. Browsing the logs collected, he sometimes can glance passwords of unaware users.
The IT department of the university where Vasya studies noticed suspicious activity and introduced a new, more secure way to enter passwords. Instead of password input field, window with 9 buttons is displayed. Buttons are arranged into 3 × 3 grid as shown in the table below.
7 | 8 | 9 |
4 | 5 | 6 |
1 | 2 | 3 |
To overcome this scheme, Vasya downloaded another cool program: mouse logger. It saves coordinates of clicks in a file, which Vasya is later able to browse. However, a complication has arisen: no information is saved about the position of password window on the screen. Indeed, it might even be partially off screen!
Your program must, given the series of mouse clicks, determine all possible corresponding passwords.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 2 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Customer support department in an "Incomprehension Amateurs, Ltd" software company has call center for answering users' questions. Support prices are as follows:
1. | Answer to a question | 10 USD |
2. | Correct answer to a question | 20 USD |
3. | Correct answer to a question with explanation | 40 USD |
4. | Correct answer to a question which was already correctly answered before | +10 USD for each previous correct answer |
So, for example, if user asks the same question three times, first receives incorrect answer, then correct one, and the third time correct answer with explanation, it will cost him 10 + 20 + (40 + 1 * 10) = 80 USD.
Customers are billed monthly according to call log. Company engineers review the log and for each question determine:
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 2 sec | |
Output file: | output.txt | Memory limit: | 128 Mb |
When wondering through the labyrinth, the goal is usually to find some kind of door. Well, not this time.
A labyrinth consists of N × N cells, each 1 × 1 meter in size. Cells are separated by doors. Each door opens in a specific direction (as shown on the picture):
Your program must find the shortest path for the traveler from north-western cell (1, 1) to south-eastern cell (N, N).
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | I. Ludov | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
In a big and rich on natural resources country, the government started a campaign to control deforestation. In fact the government is not too interested in how many trees get fallen, but rather how effectively the wood is utilized. So a law was passed which requires every logging company to pay amount of money in proportion to amount of wood that it wastes during operation.
A felling quota on some territory was allotted to a company in this country. Company lorries may only transport logs of exactly L meters long. So when a tree gets sawed into logs, the remainder is wasted.
Trees in this country grow exactly 1 meter per year, so the company may decrease the amount of tax to be paid by simply waiting for some years. Your task is to determine the number of years needed to achieve smallest possible tax. If there is more than one answer, find minimal (earliest) one.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 2 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
Text formatting functions (Format, sprintf, etc) are very common between programming languages. Your task is to implement a simplified one.
Formatting function receives format string and several arguments. Argument values are processed one by one and inserted into format string at positions designated by format specifiers. The following format specifiers must be implemented:
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 3 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Classic geometric construction is based on two instruments: ruler and compass. However, some constructions are possible using only the ruler. Specifically, let us define that if we have a set of N points, we can select two pairs of them, draw a line through each pair, and construct a new point as an intersection of these two lines. New point can then be added to the set as (N + 1)-th point, and the process repeated.
Such geometric constructions are abstract notions, and attempt to verify them with physical pencil and ruler can lead to errors caused by imprecision of these instruments. So you are tasked to write a program that does exact verification.
Your program must read a set of points and a sequence of constructing operations and find out whether the point with coordinates (0, 0) is one of the constructed points. Note that, similar to physical instruments, floating point calculations performed by computers are also imprecise. This should not, of course, alter verification results.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|