#K56002. Equal Partition of Study Hours
Equal Partition of Study Hours
Equal Partition of Study Hours
Given a list of integers representing study hours, determine whether it is possible to partition the list into two non-empty groups such that the total study hours in both groups are equal. Formally, let ( S ) be the sum of all hours. The task is to decide if there exists a subset whose sum is ( \frac{S}{2} ). Note that if ( S ) is odd, such a partition is impossible.
A dynamic programming solution is recommended to efficiently determine if a subset with the required sum exists.
inputFormat
The input is given via standard input. The first line contains an integer ( n ) representing the number of elements. The second line contains ( n ) space-separated integers representing the study hours.
outputFormat
Output a single line with either 'True' or 'False' (without quotes) indicating whether it is possible to partition the study hours into two groups with equal sum.## sample
5
3 6 1 5 9
True