CSE 2320 Lab Assignment 3
Due November 14, 2011
Understanding of dynamic programming.
Understanding of subset sums.
Design, code, and test a C program that uses
to separate (if possible) a
positive integers into three subsequences such that the sum of each subsequence is the
For example, if the input were (10, 20, 30, 40, 40, 50, 80), with a total of
= 270, the three
/3 = 90 subsequences could be (10, 80), (20, 30, 40), and (40, 50).
If the input were (20, 20, 30, 50),
then no solution is possible even though the values yield a sum (
= 120) divisible by 3 (
/3 = 40).
The input should be read from standard input (which will be one of 1. keyboard typing, 2. a shell
redirect (<) from a file, or 3. cut-and-paste.
Do NOT prompt for a file name!).
The first line of the
, the length of the sequence.
Each of the remaining lines will include one sequence value.
Your program should echo the input sequence in all cases.