Senior Division 1992
Your sample runs need not be formatted exactly like the ones shown 
here.
1.  BAR CHART   
 
Write a program that asks the user to enter a number with at most
50 digits in it an then prints out a bar chart as shown in the 
sample run. 
 
Test your program with the numbers 12345678987654321246 and 
1234565434567876545678987654321234543212321.
 
Sample Run 
 
SR92_1 BAR CHART  <Team Name> 
Please enter a number with at most 50 digits:  
12345678987654321246 
 
        I 
       HIH 
      GHIHG 
     FGHIHGF       F
    EFGHIHGFE      F
   DEFGHIHGFED    DF
  CDEFGHIHGFEDC   DF
 BCDEFGHIHGFEDCB BDF
ABCDEFGHIHGFEDCBABDF
--------------------
12345678987654321246


2.  FACTORIAL SUM LIST

Start with any number, say 25. Find the sum of the factorials of 
each of the digits of 25: 2! + 5! = 2 + 120 = 122. Repeat the procedure 
with 122 to get 1!+2!+2! = 5. Continue summing the factorials of 
the individual digits to get the next number until the list 
repeats a number. For example, starting with 25 the DIGITS 
FACTORIAL LIST is:

      25          122         5           120         4
      24          26          722         5044        169
      363601      1454        169

The list repeats the number 169 at length 13.

Write a program that asks the user to enter any number from 0 to 
9999999 and then computes the FACTORIAL SUM LIST until a 
duplicate number is found and then print the information shown in 
the sample run.

Test your program with the numbers 25 and 144.

Sample Run

SR92_2 FACTORIAL SUM LIST  <Team Name>

Please enter a number between 0 and 9999999: 25
 
      25          122         5           120         4
      24          26          722         5044        169
      363601      1454        169

      ***** LIST CYCLES BACK TO STEP 10
      ***** LIST LENGTH = 13


3.  LET'S MAKE A DEAL
 
A prize is placed behind one of N doors (where N>2). You are invited 
to find it by picking any one of the doors. Once you have chosen a 
door but before it is opened, you are given a chance to change your 
mind and switch to another door. To entice you to do so, one of the 
doors with nothing behind it is opened. Now do you want to switch? 
Would you be better off switching? Simulate this experiment by 
picking a door 100 times from a selection of N doors and always 
switching when given the chance. Repeat 10 times and report the 
results as shown in the sample run. Of course if you don't switch your 
chances of winning are exactly 1/N.

Test your program with 3 and 10 doors.

Sample Run 
 
SR92_3  LET'S MAKE A DEAL <Team Name> 
ENTER THE NUMBER OF DOORS (A NUMBER > 2): 10
 
PICK ONE OF 10 DOORS 
10 SIMULATIONS OF 100 TRIALS EACH 
WINS     LOSSES    SIMULATION PROBABILITY OF A WIN BY 
SWITCHING 
 12        88                .12
 7         93                .07
 15        85                .15
 12        88                .12
 11        89                .11
 17        83                .17
 10        90                .10
 13        87                .13
 7         93                .07
 11        89                .11
                             .115 AVERAGE


PROBABILITY OF WINNING WITHOUT SWITCHING = .1 


4. PAGE LAYOUT  

You are a document layout specialist and you are given text to input 
and  reformat into columns as in a newspaper. Unfortunately, the 
layout manager  is not sure exactly how she wants the paper to look so 
she wants you to give her some samples of different formats. The page 
width and the number of columns are variables which your program 
will use to format the text. 
 
Write a program to format a paragraph of text into various newspaper 
column sizes. The user will tell you how wide (in characters) that the 
page can be and how many columns to place the final document in. 
Use three spaces betweencolumns. For this case, you can make the 
following assumptions: 
 
There will be no more than 50 rows of input lines or 50 rows of 
output. For this problem, place the text in the body of the program as 
several strings 
so it needs to be entered only once. 
Test you program with the first paragraph above. Run the program 
with page width = 80 and number of columns = 4 and with page 
width = 70 and number of columns = 3.

Use three spaces between columns.

Sample Run

SR92_4 PAGE LAYOUT <Team Name>

Enter the width of the page:  80
Enter the number of columns:  4

You are a           newspaper.         she wants you to    are variable
document layout     Unfortunately,     give her some       which your
specialist and      the layout         samples of          program will use
you are given       manager is not     different           to format the
text to input and   sure exactly how   formats. The page   text.
reformat into       she wants the      width and the 
columns as in a     paper to look so   number columns



5. UNIQUE QUOTIENTS

Find all unique solutions to the quotient:

              ABCDE / FGHIJ = 9

where the 10 letters A,B,C,D,E and F,G,H,I,J use the 
digits 0,1,2,3,4,5,6,7,8,9 once and only once. Note: leading zeros are 
allowed, i.e., F could be 0. The efficiency of your algorithm 
will be used to award design and speed points.


Sample Run

SR92_5  UNIQUE QUOTIENTS  <Team Name>


57429 / 06381 = 9
..... / ..... = 9
..... / ..... = 9

95823 / 10647 = 9
..... / ..... = 9
..... / ..... = 9


	ICPSC 1992
	Senior Division Problems

{PAGE}


