Computer Science Canada

CCC 1997 Stage1: Problem A: Sentences

Author:  Tony [ Fri Jan 03, 2003 8:23 pm ]
Post subject:  CCC 1997 Stage1: Problem A: Sentences

Input file:
Output file: sent.out

Write a program which accepts as input a list of subjects, a list of verbs, and a list of objects, and produces all possible sentences which consist of a subject, a verb, and an object.

Input Specification
The first line of the input file contains a positive integer n which is the number of data sets which follow. For each of the n data sets, the data begins with three positive integers, one per line, each less than or equal to 20, which represent the number of subjects, verbs, and objects, respectively, which are provided. Following this line are the subjects, one per line in alphabetical order, the verbs, one per line in alphabetical order, and the objects, one per line in alphabetical order. The maximum length of any subject, predicate or object is 25 characters.

Output Specification
The output is to consist of all possible sentences which can be formed using one subject, one verb, and one object, and is to be output in alphabetical order with a period at the end of each sentence. The output for different data sets are to be separated by a single blank line.

Tony's Comment:
It should be straight farward... some for loops and thats it.

Some output can end up funny if really random words are used for input Wink

Author:  Tony [ Fri Jan 03, 2003 8:51 pm ]
Post subject:  SWAT solution

here's solution to the problem made by me (tony that is).

Solution was made using turing.

(Note to self: get a C++ compiler)

See file attached

requires file to be present in same directory following the format of the problem above. Here's the example one I used:

The cat
The dog
the mouse