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

Link to Programming Contests home page.

Quick Questions

Question 1:  Read in 2 strings and output "yes" if they form a palindrome when concatenated in either order and "no" otherwise.

input:  foo  goof
output:  yes

input:  goof  foo
output:  yes

input:  food goof
output:  no

Question 2:  Given floating point numbers a, b, and c, output "yes" if the parabola y = ax2 + bx + c has real roots (that is, if there is some point (x,0)).

Question 3:  Goobles are a currency, like Dollars or Lira.  Read in a floating point number representing the exchange rate -- that is, the number of Goobles per Dollar.  Then read in 4 integers representing some number of pennies, nickels, dimes, and quarters.  Output the value of that money in Goobles.

input:  0.75 5 5 2 6
output:  1.5
Question 4:  Read in a positive integer N and output the largest prime P < N where P has no even digits.

Question 5:  Read in an integer N followed by a word W followed by N more words of the same length as W.  Output the word after W which is "closest" by Hamming Distance to W -- that is, the one which differs by the fewest characters from W.

input:  4 port pond tart post cork
output:  post
Question 6:  Read in a number N and output the first Fibonacci number larger than N.  Recall that the Fibonacci numbers are 1, 1, 2, 3, 5, 8, 13...

Question 7:  Read in an odd positive integer N followed by N more integers, and output the median (do not count the first number N in the list).

input:  3 104 26 498
output:  104