Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class FindBits
- {
- static void Main()
- {
- int s = int.Parse(Console.ReadLine());
- int n = int.Parse(Console.ReadLine());
- int counter = 0;
- for (int i = 0; i < n; i++)
- {
- int input = int.Parse(Console.ReadLine());
- for (int j = 0; j < 24; j++)
- {
- int mask = 31 << j;
- int maskAndInput = (input & mask) >> j;
- if (maskAndInput == (s & 31))
- {
- counter++;
- }
- }
- }
- Console.WriteLine(counter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement