Day 2 Problems - Introduction

There are three problems contained in this document. Attempt as many as you can.

Important

For each problem you must save your program as 'dayNP.ext' where N is the competition day (1 or 2), P is the particular problem (A, B, or C), and ext is the extension (BAS, BC, C, CPP or PAS). For example if you write a Pascal program to solve problem A on day 2 the name should be day2a.pas. Your program should read its input from a file called day2a.dat and write the solution to a file called day2a.sol.

With each problem are two examples. These examples will be used (in addition to other unseen tests) to test your program.

Note that if your program generates correct results for these files, it does not mean that your program is correct.

There is a batch file test.bat on the D: drive that will mark your program. If you type 'test 2 a 1', it will test day2a.exe or day2a.bas with example 1. So when you have written day2a, you can test it using the two example files that you are given using the commands

test 2 a 1

and

test 2 a 2

You can similarly test your programs, day2b and day2c.

When you are finished, ensure that you have saved your files onto the root directory of the D: drive. (That is, a BASIC program for problem A should be saved as D:\day2a.bas.) You will also be given a floppy disk at the end, and you must also save your files to this disk and give it to a supervisor.

Please note that you cannot write to the C: drive.

Best of luck

Note to BASIC users: if you want your program to be compiled you should save it as 'day2a.bc', otherwise you should save it as 'day2a.bas'.