Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class BitPaths
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int[] number = new int[8];
- for (int i = 0; i < n; i++)
- {
- string[] input = Console.ReadLine().Split(',');
- int[] num = input.Select(int.Parse).ToArray();
- int bit = 3 - num[0];
- for (int j = 0; j < 8; j++)
- {
- number[j] = number[j] ^ (1 << bit);
- if (j < 7)
- {
- bit = bit + (num[j + 1] * -1);
- }
- }
- }
- int sum = number.Sum();
- string binary = Convert.ToString(sum, 2);
- Console.WriteLine(binary);
- Console.WriteLine(sum.ToString("X"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement