Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Bit_Sifting
- {
- class BitSifting
- {
- public static void Main(string[] args)
- {
- ulong bits = ulong.Parse(Console.ReadLine());
- int sieves = int.Parse(Console.ReadLine());
- for(int i = 0; i < sieves; ++i)
- {
- ulong sieve = ulong.Parse(Console.ReadLine());
- bits = bits & (~sieve);
- }
- ulong bitsCount = 0;
- while (bits > 0)
- {
- bitsCount += (bits & 1);
- bits = bits >> 1;
- }
- Console.WriteLine(bitsCount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment