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 BayIvan
- {
- class Program
- {
- static void Main(string[] args)
- {
- var wall = ulong.Parse(Console.ReadLine());
- var kits = int.Parse(Console.ReadLine());
- var numberOfAttacks = int.Parse(Console.ReadLine());
- for (int i = 0; i < numberOfAttacks; i++)
- {
- var attack = int.Parse(Console.ReadLine());
- wall = wall & ~((ulong)1 << attack);
- }
- for (int i = 0; i < 64; i++)
- {
- // bool hole = false;
- if ((wall & (ulong)1<<i) == 0 && (wall & (ulong)1<<i+1) == 0 && kits>0&&i<63)
- {
- wall = wall | ((ulong)1<<i);
- kits--;
- i++;
- // hole = true;
- while (kits>0&& (wall & (ulong)1 << i) == 0)
- {
- wall = wall | ((ulong)1 << i);
- kits--;
- i++;
- }
- }
- }
- Console.WriteLine(wall);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement