Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace XBits
- {
- class XBits
- {
- static void Main()
- {
- string[] binaries = new string[8];
- int count = 0;
- for (int i = 0; i < 8; i++)
- {
- int temp = int.Parse(Console.ReadLine());
- binaries[i] = Convert.ToString(temp, 2).PadLeft(32, '0');
- }
- for (int i = 0; i < binaries.Length; i++)
- {
- for (int j = 0; j < 32 && i+2 < 8 && j+2 < 32 && j+1 < 32 && i+1 < 8; j++)
- {
- if (binaries[i][j] == '1' && binaries[i][j+1] == '0' && binaries[i][j+2] == '1' &&
- binaries[i+1][j] == '0' && binaries[i+1][j+1] == '1' && binaries[i+1][j+2] == '0' &&
- binaries[i+2][j] == '1' && binaries[i+2][j+1] == '0' && binaries[i+2][j+2] == '1')
- {
- count++;
- }
- }
- }
- //foreach (var item in binaries)
- //{
- // Console.WriteLine(item);
- //}
- Console.WriteLine(count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment