本文整理汇总了C#中Strategy.CalculateDeceitfulWar方法的典型用法代码示例。如果您正苦于以下问题:C# Strategy.CalculateDeceitfulWar方法的具体用法?C# Strategy.CalculateDeceitfulWar怎么用?C# Strategy.CalculateDeceitfulWar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strategy
的用法示例。
在下文中一共展示了Strategy.CalculateDeceitfulWar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
string inputname = args[0];
string outputname = args[1];
string[] lines = File.ReadAllLines(inputname);
int ncases = int.Parse(lines[0]);
IList<string> results = new List<string>();
Strategy strat = new Strategy();
int nline = 0;
for (int k = 0; k < ncases; k++)
{
nline++;
int nnumbers = int.Parse(lines[nline].Trim());
nline++;
var first = lines[nline].Trim().Split(' ').Select(n => double.Parse(n)).ToList();
nline++;
var second = lines[nline].Trim().Split(' ').Select(n => double.Parse(n)).ToList();
int nwinwar = strat.CalculateWar(first, second);
int nwindwar = strat.CalculateDeceitfulWar(first, second);
results.Add(string.Format("Case #{0}: {1} {2}", k + 1, nwindwar, nwinwar));
}
File.WriteAllLines(outputname, results.ToArray());
}
示例2: CalculateDeceitfulWarCaseTwo
public void CalculateDeceitfulWarCaseTwo()
{
Strategy strat = new Strategy();
var result = strat.CalculateDeceitfulWar(new double[] { 0.7, 0.2 }, new double[] { 0.8, 0.3 });
Assert.AreEqual(1, result);
}
示例3: CalculateDeceitfulWarCaseOne
public void CalculateDeceitfulWarCaseOne()
{
Strategy strat = new Strategy();
var result = strat.CalculateDeceitfulWar(new double[] { 0.5 }, new double[] { 0.6 });
Assert.AreEqual(0, result);
}
示例4: CalculateDeceitfulWarCaseThree
public void CalculateDeceitfulWarCaseThree()
{
Strategy strat = new Strategy();
var result = strat.CalculateDeceitfulWar(new double[] { 0.5, 0.1, 0.9 }, new double[] { 0.6, 0.4, 0.3 });
Assert.AreEqual(2, result);
}
示例5: CalculateDeceitfulWarCaseFour
public void CalculateDeceitfulWarCaseFour()
{
Strategy strat = new Strategy();
var result = strat.CalculateDeceitfulWar(new double[] { 0.186, 0.389, 0.907, 0.832, 0.959, 0.557, 0.300, 0.992, 0.899 }, new double[] { 0.916, 0.728, 0.271, 0.520, 0.700, 0.521, 0.215, 0.341, 0.458 });
Assert.AreEqual(8, result);
}