Elementary Division 1994

1. WORD TRIANGLES

   D
 A   A
D  A  D

is a Word Triangle.

Any word that begins and ends with the 
same letter can be made into a Word 
Triangle.  Write a program that will 
print out Word Triangles for words of 
up to 5 letters long.  Your progam 
should ask the user to enter each row of 
the Word Triangle and then output the 
completed design.


Test your program with the words 
MOM, and  TREAT.

Sample Run

ENTER ROW 1:	T
ENTER ROW 2:	O O
ENTER ROW 3:	O   O
ENTER ROW 4:	T O O T
ENTER ROW 5:	

     T
    O O
   O   O 
  T O O T






2. SPORT OF KINGS
Man o' War and Swaps, two great 
horses from racing history, are back 
again to race each other. But this time it 
is to be done on the computer. 

Write a program that will simulate the 
greatest horse race of all time. Here are 
the rules.

1.The track is 1000  yards in length.  
The winner is the first horse to travel 
1000 yards or more.

2.Man o' War advances X yards while 
Swaps advances Y yards according to 
the rules:		
X = 9 * Y + 11 - 64 * (INT (( 9 * Y + 11)/64))
Y = 9 * X + 12 - 64 * (INT (( 9 * X + 12)/ 64))

3.To begin the race, a seed number of 
11 is chosen for Y.  This number is used 
to compute Man o' War's first 
advancement X.  The resulting X value 
is used to compute Swap's first 
advancement Y. The resulting Y value 
is used to compute Man o' War's second 
advancement X.  The resulting X value 
is used to compute Swap's second 
advancement Y. The moves continue in 
this way until the race is over.

4.Stage 1 is the total distance traveled by 
a horse after the 1st advancement.  Stage 
2 is the total distance traveled by a horse 
after the 2nd advancement.   And so on 
until the race is won.

Sample Run
SPORT OF KINGS
Stage	  Man o' War  Swaps
 1       46         41
 2       106        80
 3       148        85
_            _
_            _
And the winner is   ????



3. CRUNCH
MSSSSPP is the crunched version of 
the word MISSISSIPPI with all the I's 
taken out. A phrase can be crunched 
too!

AILOAD COSSING
is the crunched version of 
RAILROAD CROSSING
with the letter R taken out.

Write a program that will CRUNCH out 
any  letter supplied by the user from any 
phrase (up to 60 characters long).

1. The program should ask the user to 
enter a phrase and any letter to be 
crunched out. 

Test your program with the phrases:

RAILROAD CROSSING WITHOUT 
ANY R
(Remove the letter R)

CRUNCH A BUNCH OF MUNCHIES 
FOR LUNCH
(Remove the letter U)

Sample Run

ENTER A PHRASE:

RAILROAD CROSSING WITHOUT ANY R

ENTER A LETTER:  R

AILOAD COSSING WITHOUT ANY 


4. WORLD SERIES
In the World Series of Baseball two 
teams play each other until one team 
wins four games. The first team to win 
four games is the winner, and the series 
ends.  There must be at least four games 
played in a world series and it can last 
for up to seven.

Write a program that will show all the 
ways the  first four games of the World 
Series can be won or lost by a baseball 
team. A game loss is indicated with an 
L, 


a win is noted with a W.  The outcome 
of the series is a WIN or a LOSS.

Write a program that will generate a 
listing similar to the one shown in the 
sample run. Your program does not 
have to list the outcomes in the same 
order, but it must list them all. 

Sample Run

FIRST FOUR GAME OF THE 
WORLD SERIES

  GAME
1 2 3 4     WINS   LOSSES
L L L L      0       4
L L L W      1       3
L L W L      1       3
L L W W      2       2
L W L L      1       3
L W L W      2       2
L W W L      2       2
L W W W      3       1
.......      .       .
.......      .       .
W W W W      4       0

5. WELL ORDERED NUMBERS
The number 138 is called WELL-
ORDERED because the digits in the 
number (1,3,8) increase from left to 
right (1 < 3 < 8).  The number 365 is 
not well-ordered because 6 is larger than 
5.

Write a program that will find and 
display all possible three digit WELL-
ORDERED numbers. Report the total 
number of three digit WELL-
ORDERED numbers.

Sample Run
THE THREE DIGIT WELL ORDERED 
NUMBERS ARE:
123 124 125 126 127 128 129 134
135 136 137 138 139 145 146 147
148 149 156 157 158 159 167 168
... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ...
678 679 689 789

THE TOTAL NUMBER IS ??


	ICPSC 1984
	Elementary Division Problems	





