Category : Recently Uploaded Files
Archive   : CONTEST2.ZIP
Filename : RAIN.DOC

 
Output of file : RAIN.DOC contained in archive : CONTEST2.ZIP
DESCRIPTION
-----------

Paul Jones wants to live in a city with a long rainy season. With a
little research he has obtained climatological data for 20 cities.
The data includes the daily weather of each city from the past year.
To aid him in his search for the ideal city (of course there are other
factors for him to consider), he wants to rank each city by their
"longest rainy season". In this case, a "rainy season" is defined as
a period of continuous days where the number of rainy days is GREATER
than the number of sunny days.

More precisely, given array weather[CITIES][DAYS+1] of characters which
contains the weather for each day of each city for the past year, you must
rank each city from the shortest to the longest rainy season. In other
words, for "weather" with data such as:

2nd 17th
* *
weather[0] = "srrcsrssrccrsccrsscssrcrsssssrsc..."
weather[1] = "srssscsrsssrscrcssrssccrssrccssc..."
. * *
. 12th 16th
.
.

where 's' represents a sunny day, 'r' a rainy day, and 'c' a cloudy day.
In this case city #0's longest rainy season begins on the 2nd day and
ends on the 17th day (see asterisks) - a longest rainy season of 16 days.
That period is considered a rainy season since there were 6 'r's and 5 's's
during that period. Similarly city # 1's begins on the 12th day and ends
on the 16th day - a period of 5 days. Remember, a period is considered
"rainy" if the number of rainy days is greater than the number of sunny
days.

The results, which will be input in structured array "results", will look
like this:

Execution time = 45
City # Rainy Season Length
------ -------------------
4 14
19 15
15 15
3 20
6 21
... ...

For your testing purposes DAYS is set to 60 to allow for visibility of
"weather" (see RAIN.C) during run time. Also, the function
initialize_array() is provided to initialize "weather". Feel free
to change RAIN.C for your testing purposes. STREAKS.C is the only file
you need to send me. The efficiency tests will be based on 20 cities
and 365 days.



ASSUMPTIONS
-----------

* If the number of rainy days is greater than the number of sunny days
for the entire year, then the rainy season is considered to be 365 (or
equal to DAYS, as the case may be).
* Each character string in "weather" is terminated with a NULL character.



RULES
-----

1. The solution MUST be written in ANSI C (including all library functions)
for an IBM compatible computer. No Assembly is allowed.
2. The file STREAKS.C will contain your solution. All functions,
variables, macros etc. which you use should be declared in STREAKS.C.
STREAKS.C should be a totally independent file except for the macros
CITIES and DAYS which are declared in both RAIN.C and STREAKS.C.
3. All global variables MUST be initialized within one of your functions.
This rule ensures the algorithm determines the efficiency and not
initializations prior to execution.



HOW THE CONTEST WILL BE DECIDED
-------------------------------

* All entries will be compiled using a popular C compiler with all
optimizing switches off, and will be run on a 386SX computer.
* Execution time will be determined using the DOS standard clock()
function. See RAIN.C.
* All files will be compiled and run twice. The first run will test
for accuracy by executing a number of cities' data. The second run
will be with CITIES = 20 and DAYS = 365. The data will be the same
for the same for each test. The execution speed of the second run
will be used to determine the winner(s).
* Winners will be determined no later than 1 month after the final
submission date. Each contestant will receive the final results
of the contest either through email or regular mail.

Good Luck....If you have any questions call me at 509-328-9542.


  3 Responses to “Category : Recently Uploaded Files
Archive   : CONTEST2.ZIP
Filename : RAIN.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/