12.
(a) Given an array A of N positive integers and an integer M
write a recursive C function
int sos(int A[], int N, int M)
which returns 1 if there exists a subset of numbers in A
whose sum is equal to M and returns 0 otherwise.
Your function should not exceed 15 statements.
是用類似Dynamic programming的概念去找嗎?
想了想還是想不出來...OTL
請幫忙解惑<(_ _)>
謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.138.226.62
※ 編輯: alibudaken 來自: 140.138.226.62 (03/23 21:34)