NJIT High School Programming Contest Practice Problems
NJIT High School Programming Contest Practice Problems Came across some practice problems from the NJIT High School Programming Contest I attended three years ago, thought I'd share.
Practice Problem 1
Write a program that reads a line containing one or more positive integers and prints out the even numbers.
The input is a first line containing one or more positive integers. The output is a single line with each of the even numbers, appearing in the same order as the input.
For example, if the input is
77 2046 91 3 405981 378 22228
then the correct output is
2046 378 22228
Practice Problem 2
Write a program that reads a line containing one or more strings and prints out the strings on a single line with each lower canse letter changed to an upper case and each upper case letter changed to lower case.
For example, if the input is
New Jersey
then the correct output is
nEW jERSEY
Practice Problem 3
Write a program that determines the subset of a list of words that start with a given letter.
The input is a first line containing a positive integer n and a single letter c. There are n subsequent lines, each containing a word. The output is the number of words that start with c, followed by a list of those words.
For example, if the input is
4 d cat dog rabbit donkey
then the correct output is
2 dog donkey
Competition was hosted by http://web.njit.edu/~calvin/
comments powered by Disqus