Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Lines
- {
- static void Main()
- {
- int[,] n = new int[8, 8];
- for (int i = 0; i < 8; i++)
- {
- int number = int.Parse(Console.ReadLine());
- for (int j = 0; j < 8; j++)
- {
- n[i, j] = (number & (1 << j)) >> j;
- }
- }
- int countX = 0;
- int maxX = 0;
- int countMaxX = 0;
- for (int i = 0; i < 8; i++)
- {
- for (int j = 0; j < 8; j++)
- {
- if (n[i, j] == 1)
- {
- countX++;
- }
- else if (countX > 0)
- {
- if (countX > maxX)
- {
- maxX = countX;
- countMaxX = 1;
- }
- else if (countX == maxX)
- {
- countMaxX++;
- }
- countX = 0;
- }
- }
- if (countX > 0)
- {
- if (countX > maxX)
- {
- maxX = countX;
- countMaxX = 1;
- }
- else if (countX == maxX)
- {
- countMaxX++;
- }
- countX = 0;
- }
- }
- for (int j = 0; j < 8; j++)
- {
- for (int i = 0; i < 8; i++)
- {
- if (n[i, j] == 1)
- {
- countX++;
- }
- else if (countX > 0)
- {
- if (countX > maxX)
- {
- maxX = countX;
- countMaxX = 1;
- }
- else if (countX == maxX)
- {
- countMaxX++;
- }
- countX = 0;
- }
- }
- if (countX > 0)
- {
- if (countX > maxX)
- {
- maxX = countX;
- countMaxX = 1;
- }
- else if (countX == maxX)
- {
- countMaxX++;
- }
- countX = 0;
- }
- }
- if (maxX == 1)
- {
- countMaxX = countMaxX / 2;
- }
- Console.WriteLine(maxX);
- Console.WriteLine(countMaxX);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement