Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class FallDown
- {
- static void Main()
- {
- byte[] array = new byte[8];
- byte[] result = new byte[8];
- for (byte i = 0; i < 8; i++)
- {
- byte number = byte.Parse(Console.ReadLine());
- for (int j = 0; j < 8; j++)
- {
- byte mask = (byte)(1 << j);
- byte bit = (byte)(number & mask);
- bit = (byte)(bit >> j);
- array[j] += bit;
- }
- }
- for (byte k = 0; k < 8; k++)
- {
- for (byte j = 0; j < 8; j++)
- {
- if (array[j] > 0)
- {
- byte count = 0;
- count = (byte)(1 << j);
- result[k] += count;
- array[j]--;
- }
- }
- }
- Console.WriteLine(result[7]);
- Console.WriteLine(result[6]);
- Console.WriteLine(result[5]);
- Console.WriteLine(result[4]);
- Console.WriteLine(result[3]);
- Console.WriteLine(result[2]);
- Console.WriteLine(result[1]);
- Console.WriteLine(result[0]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement