Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class BitBall
- {
- static void Main()
- {
- int[] team1 = new int[8]{240,0,240,0,96,0,0,0};
- int[] team2 = new int[8]{0,0,0,6,0,15,0,15};
- int lCounter = 0;
- int rCounter = 0;
- for (int i = 0; i < 8; i++)
- {
- team1[i] = int.Parse(Console.ReadLine());
- }
- for (int i = 0; i < 8; i++)
- {
- team2[i] = int.Parse(Console.ReadLine());
- }
- for (int i = 0; i < 8; i++)
- {
- for (int j = 0; j < 8; j++)
- {
- int mask = 1;
- mask <<= i;
- int maskN1 = mask & team1[j];
- int maskN2 = mask & team2[j];
- if (maskN1 == (1<<i) && maskN2 == (1<<i))
- {
- maskN1 = ~maskN1;
- team1[j] = maskN1 & team1[j];
- maskN2 = ~maskN2;
- team2[j] = maskN2 & team2[j];
- }
- }
- }
- for (int i = 7; i >= 0 ; i--)
- {
- for (int j = 7; j >= 0; j--)
- {
- int mask = 1;
- mask <<= i;
- int maskN1 = mask & team1[j];
- if (maskN1 > 0)
- {
- bool checker = true;
- for (int k = j+1; k < 8; k++)
- {
- int mask2 = 1;
- mask2 <<= i;
- int mask2N2 = mask2 & team2[k];
- if (mask2N2 > 0)
- {
- checker = false;
- }
- }
- if (checker == true)
- {
- lCounter++;
- j = -1;
- break;
- }
- }
- }
- }
- for (int i = 7; i >= 0; i--)
- {
- for (int j = 0; j < 8; j++)
- {
- int mask = 1;
- mask <<= i;
- int maskN2 = mask & team2[j];
- if (maskN2 > 0)
- {
- bool checker = true;
- for (int k = j - 1; k >=0 ; k--)
- {
- int mask1 = 1;
- mask1 <<= i;
- int mask1N1 = mask1 & team1[k];
- if (mask1N1 > 0)
- {
- checker = false;
- }
- }
- if (checker == true)
- {
- rCounter++;
- j = 8;
- break;
- }
- }
- }
- }
- Console.WriteLine("{0}:{1}", lCounter,rCounter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement