Author |
Message |
nate
|
Posted: 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.
Description: |
|
Download |
Filename: |
Substring.java |
Filesize: |
1.55 KB |
Downloaded: |
397 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Feb 17, 2004 7:54 pm Post subject: (No 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
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
bugzpodder
|
Posted: Wed Feb 18, 2004 8:44 am Post subject: (No 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??
|
|
|
|
|
|
Tony
|
Posted: Wed Feb 18, 2004 5:35 pm Post subject: (No 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
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Brightguy
|
Posted: 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...
Description: |
|
Download |
Filename: |
Floor Plan.txt |
Filesize: |
3.88 KB |
Downloaded: |
403 Time(s) |
|
|
|
|
|
|
nate
|
Posted: Thu Feb 19, 2004 5:00 pm Post subject: (No subject) |
|
|
Thats awsome, unfourtunatly i haven't uesed VB...........yet! lol
Do you know how to do this in Java or Turing
|
|
|
|
|
|
Tony
|
Posted: Thu Feb 19, 2004 5:42 pm Post subject: (No 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
anyways, you could just "translate" the code into turing line by line, its preaty much the same, lol
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Andy
|
Posted: Thu Feb 19, 2004 8:24 pm Post subject: (No subject) |
|
|
psssh... why use arrays when u can use whatdotcolor tony?
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Fri Feb 20, 2004 3:37 pm Post subject: (No subject) |
|
|
oh yeah dodge - use whatdotcolor and the screen as your memory pallet
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|