Sample Questions from the 2006 Contest
Problem Description
Read two lists of integers. Compare the lists using the AND, OR, XOR and NOR operations.
Input/Output
Your application should prompt and read a maximum of 10 digits. The digits will be in the range of 0 to 9. The user will enter a -1 to end the list if less than 10 numbers are entered. Separate each number entered by a space. Once the first list is entered, repeat the process for a second list of integers. The second list can be the same length, longer or shorter than the first list. Each list can have any combination of the numbers 0 through 9. Each list must have at least one number.
Once both lists are entered, apply each of the follow operations to the lists:
Operation | Description |
---|---|
AND | Print all numbers that occur in both lists. These are the numbers the lists have in common. |
OR | Print all numbers that occur in either list. |
XOR | Print all numbers that occur in one list but not the other. |
NOR | Print all numbers that are not in either list. |
Sample Input 1:
8 3 7 1 -1
1 2 3 4 5 6 7 8 9 0 -1
Output 1:
A OR B = 0 1 2 3 4 5 6 7 8 9
A NOR B =
A AND B = 1 3 7 8
A XOR B = 0 2 4 5 6 9
Sample Input 2:
0 -1
3 2 8 -1
Output 2:
A OR B = 0 2 3 8
A NOR B = 1 4 5 6 7 9
A AND B =
A XOR B = 0 2 3 8
Problem Description
Read a single word and print the word as a rectangle. The word will be a maximum of 40 characters long and a minimum of two characters long.
The format of the rectangle will be:
- The word will read left to right when starting from the upper-left corner of the rectangle.
- The word will read top to bottom when starting from the upper-left corner of the rectangle.
- The word will read bottom to top when starting from the lower-right corner of the rectangle.
- The word will read right to left when starting from the lower-right corner of the rectangle.
Input/Output
Your application should accept a single word input from the keyboard. The word will be a maximum of 40 characters long and a minimum of two characters long. Print the word in the format described below. Stop the application after printing the word rectangle.
Sample Input/Output
Sample Input 1:
bookstore
Sample Output 1:
bookstore
o r
o o
k t
s s
t k
o o
r o
erotskoob
Sample Input 2:
it
Sample Output 2:
it
ti
Problem Description
Find all numbers that, when multiplied by 365, produce an eight-digit product where the first four digits of that product are equal to the last four digits of that product. For example, 271123 x 365 produces an eight-digit product (98959895) whose first four digits (9895) are equal to its last four digits (9895).
Input/Output
There is no input for this problem.
The output will be a list of the first 10 integers that, when multiplied by 365, create an eight-digit product where the first four digits of that product are equal to the last four digits of that product. Also, print the product of the number and 365. Submit a second version of your application that prints all of the numbers (not just the first 10) so the judges can see the last 10 numbers generated.
Sample Output
Output for a single random combination is listed below.
Number Number * 365
...... ........
271123 98959895
...... ........
Problem Description
Create an application that converts Arabic base 10 numbers into Roman numerals.
Input/Output
Your application should accept a single integer value input from the keyboard. This number will be in the range from 0 to 2000. Convert the number entered to its Roman numeral equivalent if the numbered entered is greater than zero. After converting to and displaying the Roman numeral, prompt the user to enter another number. Repeat these steps as long as the user enters an integer greater than zero.
End the application when the user enters a zero for the number to convert.
The highest number you must convert is 2000.
Your output will be the Roman numeral equivalent to the Arabic number entered. Each Roman numeral "letter" should be displayed in upper case. Below are the Roman numeral symbols you will use and some conversion rules.
Arabic Number | Roman Number |
---|---|
1 | I |
5 | V |
10 | X |
50 | L |
100 | C |
500 | D |
1000 | M |
- Generally, a string of Roman numerals indicates adding the values. For example, CLX would be 100 + 50 + 10, or 160. Notice that each Roman numeral is preceded by a Roman numeral that represents a larger value: L is larger than X, and C is larger than L. Placing a smaller Roman number in front of a larger Roman numeral indicates subtraction. For example, IV means 1 - 5, or 4.
- No more than three of the same Roman numeral may be used sequentially. For example, the Roman numeral for 8 is VIII, but the Roman numeral for 9 is IX, not VIIII. VIIII can't be used because it requires the symbol I to be used four times sequentially.
- You can subtract I, X, L, C or D, but not V.
- Subtract only a single Roman numeral from a single Roman numeral. For example, 8 is VIII not IIX. You can't subtract II from X because II is two Roman numerals, not one.
- Don't subtract a letter from another letter more than 10 times greater than itself. For example, the Roman numeral I can be subtracted from V or X only. X can be subtracted from X or L only.
Sample Input/Output
Your application must provide the following results for the given input. Your output must be formatted as indicated in the Output column below.
Input | Output |
---|---|
2000 | MM |
1996 | MCMXCVI |
592 | DXCII |
1091 | MXCI |
1886 | MDCCCLXXXVI |