Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Pillars
- {
- static void Main()
- {
- byte[] input = new byte[8];
- byte[] sumArrey = new byte[8];
- for (int i = 0; i < input.Length; i++)
- {
- input[i] = byte.Parse(Console.ReadLine());
- for (int n = 0; n < input.Length; n++)
- {
- int mask = 1 << n;
- int m = input[i] & mask;
- if (m != 0)
- {
- sumArrey[n]++;
- }
- }
- }
- Array.Reverse(sumArrey);
- int sum = 0;
- for (int i = 0; i < sumArrey.Length; i++)
- {
- sum += sumArrey[i];
- }
- int sumleft = 0;
- int position = 0;
- for (int i = 0; i < sumArrey.Length; i++)
- {
- int sumright = sum - sumleft - sumArrey[i];
- if (sumright == sumleft)
- {
- position = i;
- break;
- };
- sumleft += sumArrey[i];
- }
- if (position == 0)
- {
- Console.WriteLine("No");
- }
- else
- {
- Console.WriteLine(7-position);
- Console.WriteLine(sumleft);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement