#242. 数组分组求和:倍数与奇数
数组分组求和:倍数与奇数
Split Odd 10
Background
Congcong is playing a number game. He has an array of integers and wants to know if he can divide these numbers into two groups that satisfy specific conditions.
Problem Description
Given an array of integers, determine if it's possible to divide the integers into two groups such that the sum of one group is a multiple of , and the sum of the other group is odd. Every integer must belong to exactly one group. You should implement a recursive helper method that can take any arguments you deem necessary, and the initial call to this helper method should be made from a function named splitOdd10(). No loops are required for the recursive solution.
Input Format
Input is given from standard input in the following format.
A list of integers, representing the elements of the array.
Output Format
Output to standard output in the following format.
trueif such a division is possible,falseotherwise.
Sample
[5 5 5]
true
[5 5 6]
false
[5 5 6 1]
true
Sample Explanation
For the input [5 5 6 1]:
One possible division is: Group 1: [5, 5], with a sum of (which is a multiple of ); Group 2: [6, 1], with a sum of (which is odd). Since such a division exists, the output is true.
Constraints
Time limit: second. Memory limit: KiB.