コード例 #1
0
 static void Step7585()
 {
     Console.WriteLine();
     Console.WriteLine("7585");
     int[]    in7585  = { 10, 15, 20, 9, 21 };
     String[] out7585 =
     {
         "10+\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n",
         "10\n11\n12\n13\n14\n15+\n16\n17\n18\n19\n20\n",
         "10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20+\n",
         "10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n",
         "10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"
     };
     for (int i = 0; i < in7585.Length; i++)
     {
         StringBuilder result = Lab06.Task7585(new StringBuilder(), in7585[i]);
         if (out7585[i].Equals(result.ToString()))
         {
             Console.WriteLine("Задача решена верно");
         }
         else
         {
             result.Insert(0, "Неверно. Результат:\n");
             Console.WriteLine(result);
         }
     }
 }
コード例 #2
0
ファイル: Lab12Task2354.cs プロジェクト: omtit/labs
 static void Step4082()
 {
     Console.WriteLine();
     Console.WriteLine("4082");
     String[] in4082 =
     {
         "10 20 100",
         "300 400 100",
         "1000 1000 83 150",
         "1 1 1 1 1 1 1 1 199 90"
     };
     String[] out4082 =
     {
         "Сумма слева: 30, сумма справа: 0",
         "Сумма слева: 0, сумма справа: 700",
         "Сумма слева: 83, сумма справа: 2000",
         "Сумма слева: 8, сумма справа: 199"
     };
     for (int i = 0; i < in4082.Length; i++)
     {
         String result = Lab06.task4082(in4082[i]);
         Console.WriteLine(result);
         Console.WriteLine(out4082[i]);
     }
 }
コード例 #3
0
 static void Step8770()
 {
     Console.WriteLine();
     Console.WriteLine("8770");
     int[]    in8770  = { 30, 37, 40, 8, 100 };
     String[] out8770 =
     {
         "30+\n31-\n32-\n33-\n34-\n35-\n36-\n37-\n38-\n39-\n40-\n",
         "30-\n31-\n32-\n33-\n34-\n35-\n36-\n37+\n38-\n39-\n40-\n",
         "30-\n31-\n32-\n33-\n34-\n35-\n36-\n37-\n38-\n39-\n40+\n",
         "30-\n31-\n32-\n33-\n34-\n35-\n36-\n37-\n38-\n39-\n40-\n",
         "30-\n31-\n32-\n33-\n34-\n35-\n36-\n37-\n38-\n39-\n40-\n"
     };
     for (int i = 0; i < in8770.Length; i++)
     {
         var result = Lab06.Task8770(new StringBuilder(), in8770[i]);
         if (out8770[i].Equals(result.ToString()))
         {
             Console.WriteLine("Задача решена верно");
         }
         else
         {
             result.Insert(0, "Неверно. Результат:\n");
             Console.WriteLine(result.ToString());
         }
     }
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: omtit/zadaniy_cs
 static void Step10()
 {
     Console.WriteLine(Lab06.task5969(8, 13));
     Console.WriteLine(Lab06.task5969(25, 44) - 105);
     Console.WriteLine(Lab06.task5969(80, 100) - 273);
     Console.WriteLine(Lab06.task5969(300, 24) - 6279);
 }
コード例 #5
0
 public void Task5170Test()
 {
     Assert.IsFalse(Lab06.Task5170(6));
     Assert.IsFalse(Lab06.Task5170(3219));
     Assert.IsTrue(Lab06.Task5170(7));
     Assert.IsTrue(Lab06.Task5170(2017));
 }
コード例 #6
0
 static void Step4082()
 {
     Console.WriteLine();
     Console.WriteLine("4082");
     String[] in4082 =
     {
         "10 20 100",
         "300 400 100",
         "1000 1000 83 150",
         "1 1 1 1 1 1 1 1 199 90"
     };
     String[] out4082 =
     {
         "Количество слева: 2, количество справа: 0",
         "Количество слева: 0, количество справа: 2",
         "Количество слева: 1, количество справа: 2",
         "Количество слева: 8, количество справа: 1"
     };
     for (int i = 0; i < in4082.Length; i++)
     {
         String result = Lab06.Task4082(in4082[i]);
         Console.WriteLine(result);
         Console.WriteLine(out4082[i]);
         Console.WriteLine();
     }
 }
コード例 #7
0
 private static void Step6066()
 {
     Console.WriteLine();
     Console.WriteLine("6066");
     int[]    in6066a = { 8, 691, 3000 };
     int[]    in6066b = { 13, 702, 24 };
     String[] out6066 =
     {
         "8\n9\n10\n11\n12\n13\n",
         "691\n692\n693\n694\n695\n696\n697\n698\n699\n700\n701\n702\n",
         "ожидается исключение"
     };
     for (int i = 0; i < in6066a.Length; i++)
     {
         try
         {
             StringBuilder result = Lab06.Task6066(new StringBuilder(), in6066a[i], in6066b[i]);
             if (out6066[i].Equals(result.ToString()))
             {
                 Console.WriteLine("Задача решена верно");
             }
             else
             {
                 result.Insert(0, "Неверно. Результат:\n");
                 Console.WriteLine(result);
             }
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
コード例 #8
0
 private static void Step5053()
 {
     Console.WriteLine();
     Console.WriteLine("5053");
     Console.WriteLine(String.Join(" ", Lab06.Task5053(8, 13)));
     Console.WriteLine(String.Join(" ", Lab06.Task5053(691, 702)));
     Console.WriteLine(String.Join(" ", Lab06.Task5053(27, 17)));
 }
コード例 #9
0
 private static void Step2321()
 {
     Console.WriteLine();
     Console.WriteLine("2321");
     Console.WriteLine(String.Join(" ", Lab06.Task2321(8, 13)));
     Console.WriteLine(String.Join(" ", Lab06.Task2321(691, 702)));
     Console.WriteLine(String.Join(" ", Lab06.Task2321(23, 11)));
 }
コード例 #10
0
        static void Step3762()
        {
            Console.WriteLine();
            Console.WriteLine("3762");
            String result3762 = Lab06.Task3762(new StringBuilder()).ToString();

            Console.WriteLine(result3762);
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: omtit/zadaniy_cs
 static void Step9()
 {
     Console.WriteLine(Lab06.task3669(8, 13) - 1235520);
     Console.WriteLine(Lab06.task3669(159, 161) - 4095840);
     Console.WriteLine(Lab06.task3669(648, 648) - 648);
     Console.WriteLine(Lab06.task3669(-2, 600));
     Console.WriteLine(Lab06.task3669(50, 24) - 2421409269157986304L);
 }
コード例 #12
0
 private static void Step4338()
 {
     Console.WriteLine();
     Console.WriteLine("4338");
     Console.WriteLine(Lab06.Task4338(new StringBuilder(), 3, 11));
     Console.WriteLine(Lab06.Task4338(new StringBuilder(), 587, 613));
     Console.WriteLine(Lab06.Task4338(new StringBuilder(), 50, 41));
     Console.WriteLine(Lab06.Task4338(new StringBuilder(), 1000, 1000));
 }
コード例 #13
0
        static void Step2()
        {
            StringBuilder sb8495 = new StringBuilder();

            sb8495 = sb8495.Append("@");
            sb8495 = Lab06.task8495(sb8495);
            sb8495 = sb8495.Append("#");
            Console.WriteLine(sb8495.ToString());
        }
コード例 #14
0
 static void Step6580()
 {
     Console.WriteLine();
     Console.WriteLine("6580");
     Console.WriteLine("{0} ({1})", Lab06.Task6580(15, 27), 5915);
     Console.WriteLine("{0} ({1})", Lab06.Task6580(25, 44), 24470);
     Console.WriteLine("{0} ({1})", Lab06.Task6580(80, 100), 170870);
     Console.WriteLine("{0} ({1})", Lab06.Task6580(3000, 24), 9004496176);
 }
コード例 #15
0
 public void Task3669Test()
 {
     Assert.AreEqual(1235520, Lab06.Task3669(8, 13));
     Assert.AreEqual(1235520, Lab06.Task3669(13, 8));
     Assert.AreEqual(4095840, Lab06.Task3669(159, 161));
     Assert.AreEqual(648, Lab06.Task3669(648, 648));
     Assert.AreEqual(0, Lab06.Task3669(-2, 600));
     Assert.AreEqual(399703747322880000, Lab06.Task3669(35, 24));
 }
コード例 #16
0
ファイル: Lab12Task2354.cs プロジェクト: omtit/labs
 static void Step6580()
 {
     Console.WriteLine();
     Console.WriteLine("6580");
     Console.WriteLine(Lab06.task6580(15, 27) - 5915);
     Console.WriteLine(Lab06.task6580(25, 44) - 24470);
     Console.WriteLine(Lab06.task6580(80, 100) - 170870);
     Console.WriteLine(Lab06.task6580(3000, 24) - 9004496176);
 }
コード例 #17
0
 static void Step5969()
 {
     Console.WriteLine();
     Console.WriteLine("5969");
     Console.WriteLine("{0} ({1})", Lab06.Task5969(8, 13), 0);
     Console.WriteLine("{0} ({1})", Lab06.Task5969(25, 44), 105);
     Console.WriteLine("{0} ({1})", Lab06.Task5969(80, 100), 273);
     Console.WriteLine("{0} ({1})", Lab06.Task5969(3000, 24), 642600);
 }
コード例 #18
0
 static void Step9562()
 {
     Console.WriteLine();
     Console.WriteLine("9562");
     Console.WriteLine("{0} ({1})", Lab06.Task9562(15, 27), 273);
     Console.WriteLine("{0} ({1})", Lab06.Task9562(13, 2), 90);
     Console.WriteLine("{0} ({1})", Lab06.Task9562(25, 44), 690);
     Console.WriteLine("{0} ({1})", Lab06.Task9562(80, 100), 1890);
     Console.WriteLine("{0} ({1})", Lab06.Task9562(3000, 24), 4501224);
 }
コード例 #19
0
 static void Step3669()
 {
     Console.WriteLine();
     Console.WriteLine("3669");
     Console.WriteLine("{0} ({1})", Lab06.Task3669(8, 13), 1235520);
     Console.WriteLine("{0} ({1})", Lab06.Task3669(159, 161), 4095840);
     Console.WriteLine("{0} ({1})", Lab06.Task3669(648, 648), 648);
     Console.WriteLine("{0} ({1})", Lab06.Task3669(-2, 600), 0);
     Console.WriteLine("{0} ({1})", Lab06.Task3669(35, 24), 399703747322880000);
 }
コード例 #20
0
        static void Step6572()
        {
            Console.WriteLine();
            Console.WriteLine("6572");
            StringBuilder sb6572 = new StringBuilder();

            Lab06.Task6572(sb6572, 8, 13);
            Lab06.Task6572(sb6572, 691, 703);
            Lab06.Task6572(sb6572, 19, 3);
            Console.WriteLine(sb6572);
        }
コード例 #21
0
        static void Step1315()
        {
            Console.WriteLine();
            Console.WriteLine("1315");
            StringBuilder sb1315 = new StringBuilder();

            sb1315.Append("@");
            Lab06.Task1315(sb1315);
            sb1315.Append("#");
            Console.WriteLine(sb1315);
        }
コード例 #22
0
ファイル: Lab12Task7649.cs プロジェクト: omtit/labs
        static void Step3550()
        {
            Console.WriteLine();
            Console.WriteLine("3550");
            StringBuilder sb3550 = Lab06.task3550(
                new StringBuilder()
                .Append("@"))
                                   .Append("#");

            Console.WriteLine(sb3550.ToString());
        }
コード例 #23
0
ファイル: Lab12Task7649.cs プロジェクト: omtit/labs
        static void Step5411()
        {
            Console.WriteLine();
            Console.WriteLine("5411");
            String result5411 = Lab06.task5411(
                Lab06.task5411(
                    Lab06.task5411(new StringBuilder(), 7, 11)
                    .Append("\n")
                    , 211, 223).Append("\n")
                , 37, 29).Append("\n")
                                .ToString();

            Console.WriteLine(result5411);
        }
コード例 #24
0
 static void Step3550()
 {
     Console.WriteLine();
     Console.WriteLine("3550");
     int[] in3550 = { 2, 3, -13, 0, 7, 11, 1027 };
     for (int i = 0; i < in3550.Length; i++)
     {
         StringBuilder sb3550 = Lab06.Task3550(
             new StringBuilder()
             .Append("@"), in3550[i])
                                .Append("#");
         Console.WriteLine(sb3550.ToString());
     }
 }
コード例 #25
0
 static void Step7088()
 {
     Console.WriteLine();
     Console.WriteLine("7088");
     double[] in7088x = { 0,   1, 1.5, 2, 2.5,   0, 1, 1.5, 2, 2.5,   0, 1,
                          1.5, 2, 2.5, 0,   1, 1.5, 2, 2.5, 0,   1, 1.5, 2, 2.5 };
     double[] in7088y = { 1,       1,    1,  1,  1,  0,  0,  0,  0,  0, -0.5, -0.5,
                          -0.5, -0.5, -0.5, -1, -1, -1, -1, -1, -2, -2,   -2,   -2, -2 };
     for (int i = 0; i < in7088x.Length; i++)
     {
         String currentPattern = getPattern(Lab06.task7088(in7088x[i], in7088y[i]));
         Console.WriteLine(currentPattern, in7088x[i], in7088y[i]);
     }
 }
コード例 #26
0
        public void Task8418Test()
        {
            List <int> expected = new List <int> {
                1, 2, 3, 6
            };
            List <int> actual = Lab06.Task8418(6);

            CollectionAssert.AreEqual(expected, actual);

            expected = new List <int> {
                1, 5, 7, 11, 35, 55, 77, 385
            };
            actual = Lab06.Task8418(385);
            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #27
0
        static void Step5382()
        {
            Console.WriteLine();
            Console.WriteLine("5382");
            double[] in5382x         = { 5, 1, 0, 5, 1, 0, 5, 1, 0, 5, 1, 0, 5, 1, 0 };
            double[] in5382y         = { 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1 };
            String   positivePattern = "{{{0};{1}}} принадлежит области";
            String   negativePattern = "{{{0};{1}}} не принадлежит области";

            for (int i = 0; i < in5382x.Length; i++)
            {
                String currentPattern = Lab06.task5382(in5382x[i], in5382y[i]) ? positivePattern : negativePattern;
                Console.WriteLine(currentPattern, in5382x[i], in5382y[i]);
            }
        }
コード例 #28
0
 private static void Step1483()
 {
     Console.WriteLine();
     Console.WriteLine("1483");
     int[] in1483 = { 4, 18, 42, 0, -9 };
     for (int i = 0; i < in1483.Length; i++)
     {
         try
         {
             StringBuilder result = Lab06.Task1483(new StringBuilder(), in1483[i]);
             Console.WriteLine(result.ToString());
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
コード例 #29
0
 private static void Step4236()
 {
     Console.WriteLine();
     Console.WriteLine("4236");
     int[] in4236 = { 3, 12, 15, -1, 16 };
     for (int i = 0; i < in4236.Length; i++)
     {
         try
         {
             StringBuilder result = Lab06.Task4236(new StringBuilder(), in4236[i]);
             Console.WriteLine(result);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
コード例 #30
0
 private static void Step8395()
 {
     Console.WriteLine();
     Console.WriteLine("8395");
     int[] in8395 = { 1, 13, -1, 21 };
     for (int i = 0; i < in8395.Length; i++)
     {
         try
         {
             StringBuilder result = Lab06.Task8395(new StringBuilder(), in8395[i]);
             Console.WriteLine(result.ToString());
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }