DWITE
DWITE is an online programming contest based in Ontario, Canada. It is a practice contest with 5 rounds in a year, all held before other real contests. (For example, ECOO and CCC begin in March.) Its official web site is http://www.dwite.ca/.
My solutions are in Java, requiring version 5.0 or above. Using an editor with syntax highlighting is highly recommended.
Trivia: DWITE stands for Do While If Then Else.
Problems and solutions
| Contest date | Problem | Solution | Comments |
|---|---|---|---|
| 2004-10 | #1 | Area of Circle | Trivial. |
| #2 | 24 Hour Clock | Trivial. | |
| #3 | The Tallest in the Class | Straightforward: Sorting. | |
| #4 | CD-ROM Files | Subset sum problem (dynamic programming). | |
| #5 | Super Long Sums | Trivial, using java.math.BigInteger. | |
| 2004-11 | #1 | Credit Card Check Digit | Trivial. |
| #2 | Squareland | Trivial. | |
| #3 | Factoring | Rational zeros of polynomials. | |
| #4 | For Loops | Dijkstra’s shunting yard algorithm. | |
| #5 | Wind Chill | Trivial. | |
| 2004-12 | #1 | Prime Factorization | Recursion, primality testing. |
| #2 | Squareland II | Straightforward. Can be sped up from O(n4) to O(n2) by dynamic programming, though. | |
| #3 | Reflections | Trivial: Trigonometry. | |
| #4 | Waring’s Prime Number Conjecture | Brute force search with help from the Sieve of Eratosthenes. | |
| #5 | Hidden Geography | Trivial: String processing and searching. | |
| 2005-01 | #1 | DWITE Golf Tournament | Straightforward: Sorting. |
| #2 | Minesweeper | Straightforward. | |
| #3 | Harshad Numbers | Straightforward, using brute force search. | |
| #4 | Zeller’s Congruence | Trivial: Follow the given algorithm. | |
| #5 | Different Bases Multiplication | Trivial. | |
| 2005-02 | #1 | Bretschneider’s Formula | Trivial. |
| #2 | Snakes | Flood fill and neighbour count. | |
| #3 | Simple Continued Fractions | Trivial. | |
| #4 | Matrix Chain Product | Matrix chain multiplication (dynamic programming). | |
| #5 | Tsunami Speed | Trivial. | |
| 2005-10 | #1 | Odometers | Mine runs in O(n2) time, where n is the number of digits. The O(10n) solution is straightforward. |
| #2 | The Game of Life | Straightforward. | |
| #3 | Sum ’Em Up | Trivial, and the sum can be written in closed form. | |
| #4 | Minesweeper | Flood fill (recursion). | |
| #5 | Five Digit Divisibility | Brute force search through all permutations. | |
| 2005-11 | #1 | Quadrilateral Centroid | Trivial, arithmetic mean. |
| #2 | Variations on the Game of Life | Straightforward. | |
| #3 | Cinquain Poetry | Trivial. | |
| #4 | Stacking Blocks | Subset sum problem (dynamic programming). | |
| #5 | Base64 Encoding | Straightforward. | |
| 2005-12 | #1 | Semiprimes | Straightforward. |
| #2 | The Maze | Breadth-first search, and the problem is plagiarized from DWITE 2003-10 #5. | |
| #3 | Reducing Fractions | Straightforward: GCD algorithm. | |
| #4 | Now I Know My ABC’s | Trivial: Histogram. | |
| #5 | How Many Sums | Subset sum problem (dynamic programming). | |
| 2006-01 | #1 | Filling The Cone | Trivial: Algebra. |
| #2 | Scrabble | Straightforward but long. | |
| #3 | London Knights | Straightforward: Sorting. It screams for the use of SQL, though. | |
| #4 | Equivalent Amounts | Trivial. Convert to common unit, then convert from common unit. | |
| #5 | Distance Between Towns | Dijkstra’s algorithm. | |
| 2006-02 | #1 | Points on a Line | Trivial. Mine doesn’t use the division operation. |
| #2 | Floppy Disk 3½-inch High Density | Subset sum problem (dynamic programming). | |
| #3 | UPC Check Digit | Trivial. | |
| #4 | Connect-4 | Straightforward. | |
| #5 | Prime Palindromes | Straightforward: Brute force search, Sieve of Eratosthenes. | |
| 2006-10 | #1 | Pete’s Printing Press | Trivial, but the data table is large. |
| #2 | Body Mass Index | Trivial. | |
| #3 | Basketball Statistics II | Straightforward: Sorting. | |
| #4 | Count Squares | Straightforward. Can be sped up from O(n5/2) to O(n3/2) using dynamic programming, where n is the number of cells. | |
| #5 | Bad Input II | Trivial if you have access to a bignum library. | |
| 2006-11 | #1 | 13375P34|< | Trivial. |
| #2 | Lottery Ticket Checker | Trivial. | |
| #3 | Linear Binomial Products | Straightforward. | |
| #4 | Money Prize | Dynamic programming. | |
| #5 | Goldbach’s Weak Conjecture | Recursion, Sieve of Eratosthenes. | |
| 2006-12 | #1 | Jimmy’s Lost His Marbles | Subset sum problem (dynamic programming). |
| #2 | Ulam Spiral Walkway | Straightforward. | |
| #3 | Circular Primes | Straightforward. | |
| #4 | The Ubiquitous 196 | Straightforward. | |
| #5 | Caesar’s Cipher | Trivial. | |
| 2007-01 | #1 | Filling The Cone | Trivial: Algebra. Plagiarized from DWITE 2006-01 #1. |
| #2 | Minesweeper | Straightforward. Plagiarized from DWITE 2005-01 #2. | |
| #3 | Elapsed Time in Seconds | Date calculation. | |
| #4 | Number Theory | Trivial if you know about the partition function. | |
| #5 | Dutch Solitaire | Straightforward. Know how to use data structure libraries! |
Links
Last modified: 2008-04-29-Tue
Created: 2007-04-20-Fri