#242. 数组分组求和:倍数与奇数

    ID: 242 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatRecursion-2gesp6DFS递归

数组分组求和:倍数与奇数

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 1010, 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.

true if such a division is possible, false otherwise.

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 1010 (which is a multiple of 1010); Group 2: [6, 1], with a sum of 77 (which is odd). Since such a division exists, the output is true.

Constraints

Time limit: 11 second. Memory limit: 10241024 KiB.