Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 CCC 1997 Stage1: Problem A: Sentences
Index -> Contests
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony




PostPosted: Fri Jan 03, 2003 8:23 pm   Post subject: CCC 1997 Stage1: Problem A: Sentences

Input file: sent.in
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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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

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

Quote:
1
3
3
2
He
The cat
The dog
bit
kicked
saw
him
the mouse



1997 s1 p1.t
 Description:

Download
 Filename:  1997 s1 p1.t
 Filesize:  810 Bytes
 Downloaded:  360 Time(s)

Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: