Write a function, passing in an array of int, to return whether the array can be divided into two groups, so that the elements in the two groups are added together and equal, and that all multiples of 5 must be in one group, and all multiples of 3 in another group (not including a multiple of 5), can satisfy the above conditions, return True ; returns false when not satisfied.
Input Description:
The first line is the number of data, the second row is the input data
Output Description:
Returns TRUE or False
Input Example:
41 5-5 1
Output Example:
True
v1=Int (raw_input ()) V2=raw_input (). Split (' ') V2=Map (int,v2) a=[]b=[]c=[] forIinchV2:ifI%3==0 andi%5!=0:a.append (i)elifi%5==0:b.append (i)Else: C.append (i) A1=sum (a) B1=sum (b) C1=sum (c) DIF=abs (a1-B1)#X-y=dif#X+Y=C1x= (DIF+C1)%2y= (c1-dif)%2ifX==0 andY==0:## #如果x, y is 0, that is, X1 has an integer solution, it is possible to find an array that satisfies the result, and next is to determine, in a or B, whether to find the sub-array and exactly the X1x1= (DIF+C1)/2C1=Sorted (c1) Ads=0 Lis=[] I=0 whileads<=x1:lis.append (C1[i]) ads+=C1[i] I+=1Print 'true'Else: Print 'false'
Finds the sub-array of the given array, the Subarray and exactly the given target number t----dynamic planning/recursion/search (pending completion)