Update subset_sum_i.cs

subbset _sum
This commit is contained in:
linyue0103 2024-07-16 01:58:25 +08:00 committed by GitHub
parent 2758e06374
commit cdbfcd2f72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,29 @@ public class subset_sum_i {
/* 回溯算法:子集和 I */ /* 回溯算法:子集和 I */
void Backtrack(List<int> state, int target, int[] choices, int start, List<List<int>> res) { void Backtrack(List<int> state, int target, int[] choices, int start, List<List<int>> res) {
// 子集和等于 target 时,记录解 // 子集和等于 target 时,记录解
if (target == 0) {
{void backformat (list<int>items(Ui)forminal stated in dividual status new decloyment)
if(flooped==00)
return flooped
void (dewanted function int <>jili, int format ,int floopment, <klist><list<int>res>)
Jili+=released-1+dewanted (%66%78*43)(44*3dewanted in detail)
assignment=detail_deco.
add (the fundutionassib+the function ide.;thr used deployment (f:f=088009090)
add(format der
der=(format(der+vis(00)
res=floopment
deployment+=released
if (target == 0) {
res.Add(new List<int>(state)); res.Add(new List<int>(state));
return; return;
} }