Computer Science Canada

2003 S4 Substring (coded in java)

Author:  nate [ Tue Feb 17, 2004 5:57 pm ]
Post subject:  2003 S4 Substring (coded in java)

Here is my answer to the 2003 CCC S4 question.

Its a sketchy answer (probably could be done with less code)

***remeber***
Make a file called substr.in with this format
2 <- number of words
abc <- 1 word
aaa <- second word

On another note:
Does anyone have an answer to 2003 CCC Floor Plan question, or some hints to doing it.

Author:  Tony [ Tue Feb 17, 2004 7:54 pm ]
Post subject: 

for the floor plan, you first load the plan into a 2D array marking it as ether floor or wall... then x/y nested forloops to go thought each square, starting a recursion function that will spread, marking all of the floor with that room's marker as long as it is not a wall or not already marked as another room. When the function ends that room is all marked and you increase the counter.

at the end, your marker counter is your number of rooms. Then you just count unique markers to find area of each individual room Very Happy

Author:  bugzpodder [ Wed Feb 18, 2004 8:44 am ]
Post subject: 

Quote:
Its a sketchy answer (probably could be done with less code)

***remeber***
Make a file called substr.in with this format
2 <- number of words
abc <- 1 word
aaa <- second word


WHAT??

Author:  Tony [ Wed Feb 18, 2004 5:35 pm ]
Post subject: 

i think that means that file is formated in a way that the first line contains number of lines after that, each containing a single word... an example would be
Quote:

3
first
second
third

Author:  Brightguy [ Thu Feb 19, 2004 12:04 am ]
Post subject:  Re: Floor Plan Question

Here's a Visual Basic solution that I developed for the Floor Plan Question when I was going over last year's contest. The input files must be in the same folder as the application.

I must warn you though, I was trying to write it as fast as possible so the code is messy... Rolling Eyes

Author:  nate [ Thu Feb 19, 2004 5:00 pm ]
Post subject: 

Thats awsome, unfourtunatly i haven't uesed VB...........yet! lol

Do you know how to do this in Java or Turing

Author:  Tony [ Thu Feb 19, 2004 5:42 pm ]
Post subject: 

its exactly the same... it looks like the Brightguy approached the problem in a similar way I described earlier... donno, I just looked over the code quickly and saw some recursion Laughing

anyways, you could just "translate" the code into turing line by line, its preaty much the same, lol

Author:  Andy [ Thu Feb 19, 2004 8:24 pm ]
Post subject: 

psssh... why use arrays when u can use whatdotcolor tony?

Author:  Tony [ Fri Feb 20, 2004 3:37 pm ]
Post subject: 

oh yeah dodge - use whatdotcolor and the screen as your memory pallet Laughing


: