BorisSimeonov

XBits

Nov 11th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         int[] x = new int[8];
  8.         for (int cnt = 0; cnt < 8; cnt++ )
  9.         {
  10.             x[cnt] = int.Parse(Console.ReadLine());
  11.         }
  12.         int counter = 0;
  13.  
  14.         for (int row = 0; row < 6; row++)
  15.         {
  16.             for (int bitPos = 0; bitPos < 29; bitPos++)
  17.             {
  18.                 if ((x[row] >> bitPos & 7) == 5 &&
  19.                     (x[row + 1] >> bitPos & 7) == 2 &&
  20.                     (x[row + 2] >> bitPos & 7) == 5)
  21.                 {
  22.                     counter++;
  23.                 }
  24.             }
  25.         }
  26.         Console.WriteLine(counter);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment