Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- bool theArrayIsPossible = true;
- List<List<int>> room = new List<List<int>>();
- int checker = 1;
- do
- {
- List<int> arrayList = new List<int>();
- string[] arrayOfStrings = Console.ReadLine().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < arrayOfStrings.Length; i++)
- {
- arrayList.Add(int.Parse(arrayOfStrings[i]));
- }
- room.Add(arrayList);
- checker++;
- } while (checker <= 2 * n);
- for (int i = n; i < 2 * n; i++)
- {
- List<int> helper = new List<int>();
- helper = room[i];
- room[i].Reverse();
- }
- //foreach (var item in room)
- //{
- // Console.Write(string.Join(" ", item));
- // Console.WriteLine();
- //}
- int sum = 0;
- int previousSum = room[0].Count + room[n].Count;
- for (int i = 0; i < room.Count / 2; i++)
- {
- sum = room[i].Count + room[n + i].Count;
- if (sum != previousSum)
- {
- theArrayIsPossible = false;
- }
- }
- if (!theArrayIsPossible)
- {
- int overallSum = 0;
- room.ForEach(t => overallSum += t.Count);
- Console.WriteLine("The total number of cells is: {0}", overallSum);
- }
- else
- {
- for (int i = 0; i < room.Count / 2; i++)
- {
- Console.WriteLine("[" + string.Join(", ",room[i]) + ", " + string.Join(", ", room[n + i]) + "]");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment