Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _04_Is_a_List_Sorted
- {
- class Program
- {
- static void Main(string[] args)
- {
- int nLines = int.Parse(Console.ReadLine());
- List<int> operatedList = new List<int>();
- List<bool> result = new List<bool>(nLines);
- bool isTrue = true;
- for (int i = 0; i < nLines; i++)
- {
- operatedList = Console.ReadLine()
- .Split(',')
- .Select(int.Parse)
- .ToList();
- for (int j = 0; j < operatedList.Count - 1; j++)
- {
- if (operatedList[j] > operatedList[j + 1])
- {
- isTrue = false;
- break;
- }
- }
- result.Add(isTrue);
- }
- foreach (var item in result)
- {
- Console.WriteLine(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement