Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class BitBall
- {
- static void Main()
- {
- int[,] top = new int[8, 8];
- int[,] bot = new int[8, 8];
- int[,] all = new int[8, 8];
- for (int row = 0; row < 16; row++)
- {
- int num = int.Parse(Console.ReadLine());
- for (int col = 0; col < 8; col++)
- {
- if (row < 8)
- {
- top[row, col] = (num >> col) & 1;
- all[row, col] = top[row, col];
- }
- else
- {
- bot[row - 8, col] = (num >> col) & 1;
- all[row - 8, col] ^= bot[row - 8, col];
- }
- }
- }
- int scoreTop = 0;
- int scoreBot = 0;
- for (int col = 0; col < 8; col++)
- {
- for (int row = 0; row < 8; row++)
- {
- if (top[row,col] != 0 && all[row,col] != 0)
- {
- while (row < 7 && all[row + 1, col] == 0)
- {
- row++;
- }
- if (row == 7)
- {
- scoreTop++;
- }
- }
- }
- }
- for (int col = 0; col < 8; col++)
- {
- for (int row = 7; row >= 0; row--)
- {
- if (bot[row, col] != 0 && all[row, col] != 0)
- {
- while (row > 0 && all[row - 1,col] == 0)
- {
- row--;
- }
- if (row == 0)
- {
- scoreBot++;
- }
- }
- }
- }
- Console.WriteLine("{0}:{1}", scoreTop, scoreBot);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement