Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Problem5
- {
- class Problem5
- {
- static void Main()
- {
- string command = Console.ReadLine();
- int counter = 0;
- ulong floor = 0;
- ulong score = 0;
- while (command != "Stop, God damn it")
- {
- floor = ulong.Parse(command);
- string oddinput = Console.ReadLine();
- int[] apartments = oddinput.Split(' ').Select(int.Parse).ToArray();
- for (int i = 0; i < apartments.Length; i++)
- {
- floor = floor ^ (1ul << apartments[i]);
- }
- for (int i = 0; i < 32; i++)
- {
- ulong mask = (floor >> i) & 1;
- if (mask == 1)
- {
- counter++;
- }
- }
- score += floor;
- command = Console.ReadLine();
- }
- Console.WriteLine("Bohemcho left {0} lights on and his score is {1}", counter, score);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement