Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace TheBadGhost
- {
- class Program
- {
- static void Main(string[] args)
- {
- int lightsOnCounter = 0;
- ulong finalScore = 0;
- string inputString = Console.ReadLine();
- while (!inputString.Contains("Stop, God damn it"))
- {
- ulong floor = ulong.Parse(inputString);
- int[] apartments = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- for (int i = 0; i < apartments.Length; i++)
- {
- floor = floor ^ (1u << apartments[i]);
- }
- for (int i = 0; i < 32; i++)
- {
- bool isBitUp = (floor >> i & 1) == 1;
- if (isBitUp)
- {
- lightsOnCounter++;
- }
- }
- finalScore += floor;
- inputString = Console.ReadLine();
- }
- Console.WriteLine("Bohemcho left {0} lights on and his score is {1}", lightsOnCounter, finalScore);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement