• Срочно! Написать программу на С#. Дана матрица размера m*n. Найти количество строк и столбцов, которые монотонно возрастают и убывают.

Ответы 1

  • using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text.RegularExpressions;

    namespace Math

    {

       public class Program

       {

           public static void Main(string[] args)

           {

           bool yes=true;

           string s = "";

           int q = 0;

           int M, N;

           Console.WriteLine("Введите m:");    

           M = int.Parse(Console.ReadLine());

           Console.WriteLine("Введите n:");

           N = int.Parse(Console.ReadLine());

           int[,] m = new int[M,N];

           for (int i = 0; i < M; i++)  

           {

               for (int j = 0; j < N; j++)

               {

                   Console.Write("[{0},{1}] : ",i,j);

                   m[i, j] = int.Parse(Console.ReadLine());

                   s += m[i, j] + "\t";

               if (yes & m[i, 0] != m[i, j]) yes = false;

               }

               if (yes) q++;

               s += "";

               yes = true;

           }

           Console.WriteLine(s+"ответ : "+q+" строк");

           Console.ReadKey(true);

           }

       }

    }

    • Автор:

      powell
    • 6 лет назад
    • 0
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years