Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- class Program
- {
- static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- string S = Console.ReadLine();
- string SBin = Convert.ToString(int.Parse(S), 2).PadLeft(4, '0');
- int N = int.Parse(Console.ReadLine());
- int[] numbers = new int[N];
- for (int i = 0; i < N; i++)
- {
- numbers[i] = int.Parse(Console.ReadLine());
- }
- int count = 0;
- for (int i = 0; i < numbers.Length; i++)
- {
- string numberBin = Convert.ToString(numbers[i], 2).PadLeft(32, '0');
- string currentCheck = "";
- for (int j = 1; j <= 27; j++)
- {
- for (int k = 3; k >= 0; k--)
- {
- currentCheck += numberBin[numberBin.Length - j - k].ToString();
- }
- if (currentCheck == SBin)
- {
- count++;
- }
- currentCheck = "";
- }
- }
- Console.WriteLine(count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement