Here I thank you first! QQ 315829567 mailbox [email protected] thank each prawn
CodePudding user response:
using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. The Text;
The namespace ConsoleApplication1
{
Class Program
{
The static void Main (string [] args)
{
Var data="https://bbs.csdn.net/topics/20.3 23 34 46 123 145 174 173.9 220.3 237.2 198.3 183.2 177.3". The Split (new char [] {'}, StringSplitOptions. RemoveEmptyEntries). Select (x=& gt; Double. Parse (x));
Var result=foo (data, new double [] {}, 798.8, 800.9);
The foreach (var item result in)
{
Console. WriteLine (" sum: {0}, the items: {1} ", the item. The sum (), string. Join (", "item. The Select (x=& gt; X.T oString ())));
}
}
The static IEnumerableFoo (IEnumerable The data, IEnumerable Includenum, double min, double Max)
{
Double includenum_sum=includenum. Sum ();
If (includenum. Sum () & gt; Min & amp; & Includenum_sum & lt; Max) yield return includenum;
If (includenum. Sum () & lt; Min)
{
Foreach (double d in the data. The Except (includenum). The Where (x=& gt; Includenum_sum + x & lt; Max & amp; & (includenum. The Count ()==0 | | x & gt; Includenum. Max ())))
{
The foreach (var item in foo (data, includenum Concat (new double [] {d}), min, Max))
{
Yield return item;
}
}
}
}
}
}
Sum: 799.4, the items: 20.3, 23, 34, 46, 145, 173.9, 174, 183.2
Sum: 799.8, the items: 20.3, 23, 34, 145, 174, 183.2, 220.3
Sum: 799.7, the items: 20.3, 23, 34, 145, 173.9, 183.2, 220.3
Sum: 800.8, the items: 20.3, 23, 34, 173.9, 174, 177.3, 198.3
Sum: 800.8, the items: 20.3, 23, 46, 123, 174, 177.3, 237.2
Sum: 800.7, the items: 20.3, 23, 46, 123, 173.9, 177.3, 237.2
Sum: 800.8, the items: 20.3, 34, 46, 123, 174, 183.2, 220.3
Sum: 800.7, the items: 20.3, 34, 46, 123, 173.9, 183.2, 220.3
Sum: 800.8, the items: 20.3, 34, 46, 145, 174, 183.2, 198.3
Sum: 800.7, the items: 20.3, 34, 46, 145, 173.9, 183.2, 198.3
Sum: 799.8, the items: 20.3, 34, 173.9, 174, 177.3, 220.3
Sum: 799.8, the items: 20.3, 46, 145, 174, 177.3, 237.2
Sum: 799.7, the items: 20.3, 46, 145, 173.9, 177.3, 237.2
Sum: 799.1, the items: 20.3, 46, 174, 177.3, 183.2, 198.3
Sum: 799, the items: 20.3, 46, 173.9, 177.3, 183.2, 198.3
Sum: 799.1, the items: 20.3, 123, 198.3, 220.3, 237.2
Sum: 800.1, the items: 20.3, 145, 177.3, 220.3, 237.2
Sum: 799.4, the items: 20.3, 177.3, 183.2, 198.3, 220.3
Sum: 799.7, the items: 23, 34, 145, 177.3, 183.2, 237.2
Sum: 799.1, the items: 23, 46, 145, 173.9, 174, 237.2
Sum: 799.5, the items: 23, 145, 174, 220.3, 237.2
Sum: 799.4, the items: 23, 145, 173.9, 220.3, 237.2
Sum: 798.9, the items: 34, 46, 123, 177.3, 198.3, 220.3
Sum: 800.7, the items: 34, 46, 123, 177.3, 183.2, 237.2
Sum: 800.5, the items: 34, 173.9, 174, 198.3, 220.3
Sum: 800.5, the items: 46, 123, 174, 220.3, 237.2
Sum: 800.4, the items: 46, 123, 173.9, 220.3, 237.2
Sum: 800.5, the items: 46, 145, 174, 198.3, 237.2
Sum: 800.4, the items: 46, 145, 173.9, 198.3, 237.2
Sum: 800.8, the items: 46, 174, 177.3, 183.2, 220.3
Sum: 800.7, the items: 46, 173.9, 177.3, 183.2, 220.3
Sum: 799.1, the items: 123, 145, 173.9, 174, 183.2
Sum: 800.8, the items: 145, 198.3, 220.3, 237.2
Press any key to continue...
CodePudding user response:
Moderators can you teach me the private chat I quickly sorrow died, now used to reading when learning VB simple operation, all returned to the teacher now, QQ: 315829567 my contact informationCodePudding user response: