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 ConsoleApplication2
- {
- class Program
- {
- //static bool theCenterOfTheCrossroad(int[] row, int[] column, int i, int j)
- //{
- // bool b;
- // if (column.Contains(j))
- // {
- // }
- //}
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int step = int.Parse(Console.ReadLine());
- int counter = 0;
- int added = 0;
- string newnumber = string.Empty;
- string bitwise = string.Empty;
- List<string> input = new List<string>();
- string output = string.Empty;
- int checker = 0;
- for (int i = 0; i < n; i++)
- {
- int numberForChange = int.Parse(Console.ReadLine());
- bitwise = Convert.ToString(numberForChange, 2).PadLeft(8, '0');
- input.Add(bitwise);
- counter++;
- }
- foreach (var item in input)
- {
- newnumber += item;
- }
- int f = 0;
- char[] array = newnumber.ToCharArray();
- for (int j = 0; j < counter * 8; j++)
- {
- if ( 1 + (j * step) < counter * 8)
- {
- f = (j * step);
- if (array[f] == '0')
- {
- array[f] = '1';
- }
- else
- {
- array[f] = '0';
- }
- }
- else
- {
- break;
- }
- }
- Console.WriteLine(array);
- int flushed = 1;
- for (int v = 0; v < counter * 8; v++)
- {
- if (checker != 7)
- {
- output += array[v];
- checker++;
- }
- else
- {
- output += array[v];
- Console.WriteLine(output);
- int p = Convert.ToInt32(output, 2);
- Console.WriteLine(p);
- output = string.Empty;
- flushed++;
- checker = 0;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment