Ten teams from various schools in Idaho participated in the third
High School programming contest. There were a total of 26 students
and the teams were from the following schools:
- Borah High School (1 team)
- Emmett High School (2 teams)
- Vallivue High School (2 teams)
- Capital High School (1 team)
- Centennial High School (2 team)
- Middleton High School (1 team)
- Boise High School (1 team)
The first place team was from Centennial High School.
The team members were Mike Rolig, Kevin Turner, Chris Callour.
The second place team was also from Centennial High School.
The team members were John O'Rorke, John Rotman, Tim Maness.
A total of seven teams were able to finish one program correctly.
Here are the problems used in the competition.
Description: Display the perimeter of an n by n square.
Input: A sequence of nonnegative integers n, one per line,
terminated by 0.
Output: The perimeter of a square with sides n.
An * should be used to denote the side of a square.
Format each line so that there is a blank character between
adjacent *s. Separate output from different squares by at least
one blank line.
Example:
Input: Output:
3 * * *
5 * *
0 * * *
* * * * *
* *
* *
* *
* * * * *
Description:
Any one-to-one mapping, f, of any alphabet to itself can be used to encode
text by replacing each occurrence of any letter, c, with f(c). One such
mapping could be the mapping of a letter to three positions beyond the
letter in the alphabet. That is, a --> d, b --> e,
c --> f, d --> g and so on. With this mapping, ``The
car is blue.'' will be encoded as ``Wkh fdu lv eoxh.''
Write a program that decodes the contents of its input file according
to the following guidelines:
- Upper case letters are mapped to upper case letters and lower
case letters are mapped to lower case letters (A --> D, Z --> C, a --> d, z --> c).
- The mapping that defines the encoding is one-to-one. That
is, two different letters never map to the same letter of the
alphabet ( a --> x and t --> x is impossible).
- The program will loop through the input until it encounters
end of input printing the output to the screen.
- The first character of the encoded test will be a digit from
0 to 9 representing the offset by which the text is mapped.
- If needed, you may assume that the string of text will be no
longer than 200 characters.
- Non alphabetic characters are to be printed without encoding.
- Input: A sequence of encoded characters.
- Output: Output from your program will be the decoded characters.
Example:
Input:
3Whvw gdwd lv DEF ABC def abc
Output:
Test data is ABC XYZ abc xyz
Input:
9Rc'b j carlth xwn, cx bqxf qxf rc fxatb!
Output:
It's a tricky one, to show how it works!
Description:
Read the description for the previous problem (Shifty
Text). Now suppose we do not know by how much the characters
have been shifted. One possibility is to scan the text and build a
frequency table (a histogram) of all the alphabetic characters. For the
purposes of building the frequency table, we shall consider lower case
and upper case characters to be equivalent. After building the table,
we can find out the most frequently occurring character. From analysis
of large number of English texts, it has been found that the character
'e' is the most frequently occurring character.
For example, suppose we find the character 'g' to be the most frequent
character in the given encoded text. Then we conclude that the
document was shifted by 2. Now we can decode the document as described
in the Shifty Text problem.
- Input: The encoded text is provided as input through the
console. You can assume that the size of the text file is no more than
30000 characters.
- Output: The decoded text should be output to the console.
Example:
Input:
Mtb yt mfaj ymj qfxy btwi ns wjfq qnkj ``Dtz'wj wnlmy!'' Mtb yt mfaj ymj
qfxy btwi ts Zxjsjy "Dtz'wj ns rd pnqqknqj!"
Output:
How to have the last word in real life ``You're right!'' How to have the
last word on Usenet "You're in my killfile!"