Sewickley Academy Programming Team
Programming Contest:  21-Feb-2001
David Kosbie (Faculty Advisor)
Sewickley Academy

Link to Programming Contests home page.

Quick Questions

Question 1:  Read in 5 strings and output "yes" if any of the strings is a substring of any of the other strings (that is, if any string occurs completely within another one).

input:  apple orange go apogee cart
output:  no

input:  apple orange go pogostick cart
output:  yes

input:  apple orange go apple cart
output:  yes

Question 2:  Read in a non-negative number N and output all the points in the upper-right quadrant (where x and y are both non-negative) where the sum of x and y is less than or equal to N.  You must output the points along the increasing diagonals from upper-right to lower-left.
input:  3
output:  (0,1) (1,0) (0,2) (1,1) (2,0) (0,3) (1,2) (2,1) (3,0)
Question 3:  Read in a word and output the number of letters in the word whose ASCII value is prime.

Question 4:  Read in eight floating point numbers -- x1, y1, x2, y2, x3, y3, x4, y4.  The describe two line segments (not lines, just line segments) -- one connecting (x1,y1) and (x2,y2), the other connecting (x3,y3) and (x4,y4).  Output "yes" if these two line segments intersect, and "no" otherwise.

Question 5:  Read in a positive number N and output the Nth row of Pascal's Triangle.  Pascal's Triangle is computed as follows:  the first and last element in each row is a 1, and each element in between is the sum of the two elements above it.  As such:

1
1   1
1   2   1
1   3   3   1
1   4   6   4   1
input:  3
output:  1 2 1
Question 6:  Read in a number N between -999 and 999 and output that number in English.
input:  -73
output:  minus seventy three

input:  204
output:  two hundred four

Question 7:   Assume that January 1st is a Monday and that this is not a leap year.  Read in two numbers -- the month (where 1 is January and 12 is December) and the day -- and output which day of the week that day is.
Hint:  Months with 31 days:  January, March, May, July, August, October, December.
Months with 28 days:  February.
Months with 30 days:  All others.