UW CEMC

Canadian Computing Competition

Stage 2 Problems, Solutions and Test Data

University of Waterloo | Official CCC Website | Unofficial Stage 1 Solutions




Last Updated: February 27, 2008
Currently, this page is incomplete. I am working hard to organize my other solutions before posting them on this website. It is a tedious process to get everything together, but please check back for frequent updates.


This website contains solutions to the Stage 2 problems from the Canadian Computing Competition. This website, and all of its solutions, are unofficial. All problems and test data were created by the University of Waterloo.

All solutions were programmed by Aaron Voelker from Bell High School (Ottawa), with the C programming language. The purpose of this page is to provide additional learning resources for teachers and students looking for fun Computer Science problems and efficient solutions.

Solutions exist for many of the Stage 2 problems on the Official CCC Website. Since the official site is not intended to be a learning resource, it is currently incomplete, and lacking explanations to the solutions.

If you see any mistakes, or would like to discuss anything Computer Science related with me, please give me a shout at dr.sane@gmail.com.

The test data for many competitions is not on the official website. Most test data from 1997 and 1998 were created by me. Please let me know if you see any mistakes, or would like to add your own input files to my collection.



2007

Sort all problems by Year, Fun, or Difficulty.


Snowflakes
Difficultydifficult difficult difficult difficult difficult   (2/5) Problem 1.2 (2007)
Hint
Answer
Solution
Funfun fun fun fun fun   (3/5)
TopicsComparisons
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19


Bowling For Numbers++
Difficultydifficult difficult difficult difficult difficult   (5/5) Problem 1.3 (2007)
Hint
Answer
Solution, Related Code: Stage 1 Solution
Funfun fun fun fun fun   (4/5)
TopicsDynamic Programming
Input:  1 | 2 | 3 | 4
Output:  1 | 2 | 3 | 4


Road Construction
Difficultydifficult difficult difficult difficult difficult   (4/5) Problem 2.3 (2007)
Hint
Answer
Solution, Related Code: Strategic Bombing 2001
Funfun fun fun fun fun   (4/5)
TopicsGraph Theory
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15



2004

Sort all problems by Year, Fun, or Difficulty.


Scribble
Difficultydifficult difficult difficult difficult difficult   (1/5) Problem 1.1 (2004)
Hint
Answer
Solution
Funfun fun fun fun fun   (3/5)
TopicsString Processing
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15


Hockey Scores
Difficultydifficult difficult difficult difficult difficult   (2/5) Problem 1.2 (2004)
Hint
Answer
Solution
Funfun fun fun fun fun   (4/5)
TopicsGreedy Algorithms
Nodes
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8


S & K
Difficultydifficult difficult difficult difficult difficult   (4/5) Problem 1.3 (2004)
Hint
Answer
Solution
Funfun fun fun fun fun   (1/5)
TopicsTree Operations
Garbage Collection
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10


Return Of Space Turtle
Difficultydifficult difficult difficult difficult difficult   (3/5) Problem 2.1 (2004)
Hint
Answer
Solution
Funfun fun fun fun fun   (3/5)
TopicsGeometry
Relative Motion
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7


Jengaism
Difficultydifficult difficult difficult difficult difficult   (2/5) Problem 2.2 (2004)
Hint
Answer
Solution
Funfun fun fun fun fun   (2/5)
TopicsSupport Structures
Logic and Reasoning
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10


Orko
Difficultydifficult difficult difficult difficult difficult   (4/5) Problem 2.3 (2004)
Hint
Answer
Solution
Funfun fun fun fun fun   (5/5)
TopicsGame Theory
Dynamic Programming
Input:  1 | 2 | 3
Output:  1 | 2 | 3



1998

Sort all problems by Year, Fun, or Difficulty.


Fibonacci Numbers
Difficultydifficult difficult difficult difficult difficult   (1/5) Problem 1.1 (1998)
Hint
Answer
Solution, Related Code: Recursive Solution
Funfun fun fun fun fun   (4/5)
TopicsLarge Data Types
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7


Message Deciphering
Difficultydifficult difficult difficult difficult difficult   (1/5) Problem 1.2 (1998)
Hint
Answer
Solution
Funfun fun fun fun fun   (4/5)
TopicsProbability
Cyphering
Input:  1 | 2 | 3 | 4 | 5
Output:  1 | 2 | 3 | 4 | 5


Bus Schedule
Difficultydifficult difficult difficult difficult difficult   (3/5) Problem 1.3 (1998)
Hint
Answer
Solution
Funfun fun fun fun fun   (2/5)
TopicsGraph Search Algorithm
Input:  1
Output:  1



1997

Sort all problems by Year, Fun, or Difficulty.


Palindromes
Difficultydifficult difficult difficult difficult difficult   (1/5) Problem 1.1 (1997)
Hint
Answer
Solution
Funfun fun fun fun fun   (2/5)
TopicsString Traversal
Memory Management
Input:  1 | 2 | 3 | 4 | 5
Output:  1 | 2 | 3 | 4 | 5


Alien Invasion
Difficultydifficult difficult difficult difficult difficult   (4/5) Problem 1.2 (1997)
Hint
Answer
Solution
Funfun fun fun fun fun   (3/5)
TopicsData Structures
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10


High Tide
Difficultydifficult difficult difficult difficult difficult   (1/5) Problem 2.1 (1997)
Hint
Answer
Solution
Funfun fun fun fun fun   (3/5)
TopicsPhysics
Math
Input:  1 | 2 | 3 | 4 | 5
Output:  1 | 2 | 3 | 4 | 5


Space Aliens
Difficultydifficult difficult difficult difficult difficult   (3/5) Problem 2.2 (1997)
Hint
Answer
Solution
Funfun fun fun fun fun   (3/5)
TopicsVectors
Recursion
Input:  1 | 2 | 3
Output:  1 | 2 | 3


Aligning DNA
Difficultydifficult difficult difficult difficult difficult   (5/5) Problem 2.3 (1997)
Hint
Answer
Solution
Funfun fun fun fun fun   (4/5)
TopicsDynamic Programming
Outputting Best Path
Input:  1 | 2 | 3 | 4 | 5 | 6 | 7
Output:  1 | 2 | 3 | 4 | 5 | 6 | 7