コード例 #1
0
ファイル: TrySail.cs プロジェクト: wittyResry/topcoder
// CUT begin
    static bool DoTest(int[] strength, int __expected)
    {
        DateTime  startTime = DateTime.Now;
        Exception exception = null;
        TrySail   instance  = new TrySail();
        int       __result  = 0;

        try {
            __result = instance.get(strength);
        }
        catch (Exception e) { exception = e; }
        TimeSpan __elapsed = new TimeSpan(DateTime.Now.Ticks - startTime.Ticks);

        if (exception != null)
        {
            Console.Error.WriteLine("RUNTIME ERROR!");
            Console.Error.WriteLine(exception);
            return(false);
        }
        else if (__result == __expected)
        {
            Console.Error.WriteLine("PASSED! " + string.Format("({0:0.00} seconds)", __elapsed.TotalSeconds));
            return(true);
        }
        else
        {
            Console.Error.WriteLine("FAILED! " + string.Format("({0:0.00} seconds)", __elapsed.TotalSeconds));
            Console.Error.WriteLine("           Expected: " + __expected);
            Console.Error.WriteLine("           Received: " + __result);
            return(false);
        }
    }
コード例 #2
0
    public void Example4()
    {
        int[] strength = new int[] {
            108,
            66,
            45,
            82,
            163,
            30,
            83,
            244,
            200,
            216,
            241,
            249,
            89,
            128,
            36,
            28,
            250,
            190,
            70,
            95,
            117,
            196,
            19,
            160,
            255,
            129,
            10,
            109,
            189,
            24,
            22,
            25,
            134,
            144,
            110,
            15,
            235,
            205,
            186,
            103,
            116,
            191,
            119,
            183,
            45,
            217,
            156,
            44,
            97,
            197
        };
        int __expected = 567;
        int __result   = new TrySail().get(strength);

        Assert.AreEqual(__expected, __result);
    }
コード例 #3
0
    public void Example0()
    {
        int[] strength = new int[] {
            2,
            3,
            3
        };
        int __expected = 8;
        int __result   = new TrySail().get(strength);

        Assert.AreEqual(__expected, __result);
    }
コード例 #4
0
    public void Example1()
    {
        int[] strength = new int[] {
            7,
            3,
            5,
            2
        };
        int __expected = 17;
        int __result   = new TrySail().get(strength);

        Assert.AreEqual(__expected, __result);
    }
コード例 #5
0
    public void Example3()
    {
        int[] strength = new int[] {
            114,
            51,
            4,
            191,
            9,
            81,
            0,
            89,
            3
        };
        int __expected = 470;
        int __result   = new TrySail().get(strength);

        Assert.AreEqual(__expected, __result);
    }