Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- class Solution
- {
- static void Main(string[] args)
- {
- string MESSAGE = "Chuck Norris' keyboard has 2 keys: 0 and white space."
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- byte[] bajty = Encoding.ASCII.GetBytes(MESSAGE);
- string odpowiedz="";
- string wiadomosc ="";
- int dlugosc=0;
- foreach (byte b in bajty)
- {
- wiadomosc+=Convert.ToString(bajty[dlugosc], 2);
- dlugosc++;
- }
- Console.Error.WriteLine(MESSAGE);
- dlugosc=0;
- foreach (char c in wiadomosc)
- {
- dlugosc++;
- }
- if(dlugosc<7)
- {
- wiadomosc=wiadomosc.PadLeft(7, '0');
- dlugosc=0;
- foreach (char c in wiadomosc)
- {
- dlugosc++;
- }
- }
- Console.Error.WriteLine(wiadomosc);
- for (int i=0;i<dlugosc;i++)
- {
- if (i!=0)
- if(wiadomosc[i]!=wiadomosc[i-1])
- odpowiedz+=" ";
- if(wiadomosc[i]=='0')
- {
- if(i==0)
- {
- odpowiedz+="00 0";
- }
- else if(i!=0)
- if (wiadomosc[i]=='0'&&wiadomosc[i-1]=='0')
- odpowiedz+="0";
- else
- odpowiedz+="00 0";
- }
- else
- {
- if(i==0)
- {
- odpowiedz+="0 0";
- }
- else if (wiadomosc[i]=='1'&&wiadomosc[i-1]=='1')
- odpowiedz+="0";
- else
- odpowiedz+="0 0";
- }
- }
- Console.WriteLine(odpowiedz);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement