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.

Andrius has not quite decided how much time he would like to spend in his hiking tour.Task. Write a program to help the hiker to calculate lengths of the chosen routesand to find out if the selected routes satisfy his wish not to cross towns more than onceexcept for his home-town. The program should also found the shortest and the longestroute from the routes suggested by Andrius and satisfying his wishes.If there are several shortest or longest routes, it is enough to find out any one ofthem. It can be happen that none of the routes will satisfy the conditions.Input. Input data should be entered from the keyboard. It is known that number oftowns k belongs to the interval 2 ≤ k ≤ 15, and the coordinates of the towns x i, y ibelong to the interval 10000 ≤ x i, y i≤ 10000, i = 0, 1, …k. All data are integers.This is an interactive task. The dialog between the program and the user shouldlook as presented below. Output data (from keyboard) are printed in bold. All thedialog messages that can be printed out by your program should be found in the filePRAN.TXT. The message to be printed if none of the suggested routes are acceptableshould be found in the mentioned file.Assume that the entered data are correct. The same town can be indicated severaltimes, but not subsequently (i.e. it will not be possible to travel from some town A tothe same town A).The length of the route to be printed should be rounded in the precision of twodigits after a decimal.STAGE III, PART II19SENIOR DIVISION195. Packing Pascal programs. (Runtime limit – to 10 sec.; processor Pentium133 MHz) There are written some packing (data compression) programs. But sometimesone can achieve better results if it is known in advance how the file to be packedwill look like.There is given a file (extension. PAS) containing Turbo Pascal program (or library).None of the lines of this file end with a space character.Task. You should write two programs: 1) for packing the given file; 2) for unpackingthe given file. When packing and unpacking assume that capital and small Latinletters are equivalent. The given and unpacked programs should coincide.It is not allowed to use any of standard packing programs (arj, pkzip, rar and soon). During unpacking it is not allowed to use input file (PROGR.PAS) containing notcompressed program.First program: packing.Input. Program to be packed is written to the file PROGR.PAS. The size of the filewill not exceed 65000 bytes.Output. Write the packed program to the file PROGR.PAK.Second program: unpacking.

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

Saved successfully!

Ooh no, something went wrong!