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.

24number of lines, how many times theExamplephrase was found in the text. Each lineInputOutputshould contain two integers indicating the1 11 3place where the found phrase starts. Theselittleshould be the number of the line in theA little rabbit.text and the position in that line.Numbers of lines in the output file must be presented in ascending order.200. Checkers. On the black cells of square checkerboard there are placed several black and white pieces andone gray piece. White and black pieces do not make anymoves, and the gray one captures black pieces accordingto common rules: gray checker captures a black piece byjumping over it, diagonally, to the adjacent vacant squarebeyond it. The three squares must be lined up (diagonallyadjacent). But there is one restriction: the gray piececan capture black one only forward, i.e. number of lineof the gray piece can only increase.Task. Write a program to calculate the maximum numberof black pieces that can be captured by the gray piece in one move. One moveconsists of one or more jumps.Input. The first line of the input file contains the size of the board n (3 ≤ n ≤ 60).The second line contains the total number of pieces on the board M.Further there are such M lines. Each line indicates thecolor and the position of one piece in the following way:S x yS can be one of the three symbols: J means black, B– white, P – gray piece; x is the number of column, y –the number of row.Columns are numbered starting with one from rightto left and upwards. Cell (1, 1) is white. There is oneand only one line in the input data beginning with letterP (there is only one gray piece).Output. The maximum number of black pieces thatthe gray piece can capture with one move – should bewritten to the first line of the result file.Input98J 2 7J 3 6B 8 9J 5 6P 4 5J 5 2J 5 4J 7 8Picture 200.1ExampleOutput1201. Interpreter of Machine–language Codes. (Run time limit - 50 sec., processorPentium 133 MHz) Nowadays programmers practically do not have to dealwith machine–language codes. Essentially any program (for example, TURBO.EXE)is just a set of codes (binary digits) for a computer. Some numbers from this set meanprocessor instructions, the other ones – data for these instructions.

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

Saved successfully!

Ooh no, something went wrong!