我正在设法找到处理以下问题的最佳方法:
我真的很难找到最有效的方法来做这个手术。我真的在努力减少循环数据的次数。有什么明显的方法我只是在修饰吗?
如能就可能的前进道路提出任何建议,将不胜感激。
new #1 = #1
new #2 = #2 * (1 - #1)
new #3 = #3 * (1 - #1) * (1 - #2)
new #4 = #4 * (1 - #1) * (1 - #2) * (1 - #3)发布于 2013-11-20 05:52:18
就地替换:
List<decimal> data =....
decimal multiplier = 1.0;
for (var i = 0; i < data.Count; i++)
{
var oldMultipleir = multiplier;
multiplier *= (1 - data[i]);
data[i] *= oldMultiplier;
}https://stackoverflow.com/questions/20088241
复制相似问题