Problem four:
Exercise in the Land of the Woolies
One of the more popular forms of physical exercise in the land of the
Woolies is the circle walk. In this activity a group of Woolies get
together and draw a circle in the sand. The Woolies then mark a
single point on the circle, meet at that point, and then start walking
around the circle at different speeds and in different directions.
Each Woolie continues to walk at the same speed and in the same
direction until all of the Woolies reach the start point at the same
time. The first time all of the Woolies meet at the starting point
marks the end of the exercise period. After any form of physical
exercise, it is the Woolie custom to go to a local pub and participate
in a Woolie Bolie to celebrate the end of the exercise period.
You are to write a program that given:
- The number of Woolies
- The circumference of the circle in Wooleans
- The speed of each Woolie in Wooleans per second (WPS)
- The direction each Woolie is walking in (yps, or ilon)
Prints out the length of time in seconds the circle walk activity will
take. The input to your program will come from standard input. A
sample run of this program is given below:
2
100
10 yps
5 ilon
Circle walk duration: 20 seconds
This input describes two Woolies performing a circle walk around a
circle 100 Wooleans in circumference. The first Woolie is walking at
a rate of 10 WPS in the yps direction (yps is translated to clockwise
in the 3rd edition of the Wolie to English dictionary), and the second
Woolie is walking at a rate of 5 WPS in the ilon direction (the
counter-yps direction). The two Woolies will circle walk for 20
seconds.
Doug Lea
Last modified: Mon Oct 18 09:40:15 EDT 1999