Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Lines
- {
- static void Main()
- {
- int[,] matrix = new int[8,8];
- for (int row = 0; row < 8; row++)
- {
- int number = int.Parse(Console.ReadLine());
- for (int col = 0; col < 8; col++)
- {
- //int bits = number >> col & 1;
- //if(bits != 0){}matrix[row, col] = 1;
- matrix[row, col] = number >> col & 1;
- }
- }
- int len = 0, bestLen = 0, count = 0;
- for (int row = 0; row < 8; row++)
- {
- for (int col = 0; col < 8; col++)
- {
- while (col < 8 && matrix[row, col] == 1)
- {
- len++;
- col++;
- }
- if (len == bestLen)
- {
- count++;
- }
- if(len > bestLen)
- {
- bestLen = len;
- count = 1;
- }
- len = 0;
- }
- }
- for (int col = 0; col < 8; col++)
- {
- for (int row = 0; row < 8; row++)
- {
- while (row < 8 && matrix[row, col] == 1)
- {
- len++;
- row++;
- }
- if (len == bestLen)
- {
- count++;
- }
- if (len > bestLen)
- {
- bestLen = len;
- count = 1;
- }
- len = 0;
- }
- }
- if (bestLen == 1)
- {
- count = count / 2;
- }
- Console.WriteLine(bestLen);
- Console.WriteLine(count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment