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.

We will analyze the following computing machine model. Machine has N cellmemory. Cells are numbered from 0 to N–1. To any cell an integer from 0 to 2 k –1 canbe written. The machine has got one additional cell of memory; we will call it registerR. One integer from the interval 0..N–1 can be memorized in this register.Any program executed by this machine is written to memory starting with a certaincell (the number of this cell is called an address). The address of this certain cellis written to register R.The first The second The thirdfield of an field of an field of anExplanations of instructionsinstruction instruction instruction0 I J Content of the cell J is written to the cell having address I.1 I J Content of the cell L[J] is written to the cell havingaddress I. Content of the cell J remains the same.2 I J Operation L[I] + J is executed. Result of composition iswritten to the cell I (i.e. to the cell having address I).3 I J Operation L[I] + L[J] is executed. Result of compositionis written to the cell I.4 I J Operation L[I] –J is executed. The result of subtraction iswritten to the cell I.5 I J Operation L[I] – L[J] is executed . Result of subtractionis written to the cell I.6 I – Number is read from the keyboard, the cursor moves to anew line and the number that was read is written to thecell I.7 I – Number L[I] is printed to screen and the cursor moves toa new line.8 I J If L[I] > L[J], number 1 is written to the cell I, otherwisethere is written zero.9 I J If L[I] = L[J], number 1 is written to the cell I, otherwisethere is written 0.A I J If L[I] < L[J], number 1 is written to the cell I, otherwisethere is written 0.B I J If L[J] = 0, then it is moved to the cell I, and theinstruction that is in that cell is executed; otherwisefurther instructions are executed.C I J If L[J] ≠ 0, then it is moved to the cell I, and theinstruction that is in that cell is executed; otherwisefurther instructions are executed.D I – It is moved to the cell I, and the instruction in that cell isexecuted.E – – Halt; Program is finished (the processor stops after thiscommand).25

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

Saved successfully!

Ooh no, something went wrong!