I can’t solve the last problem.
Which action do I have to do?
Yo, I get a weird error coming from outside my code.
It persists even when I put all my code in comment and only write return 0; in the main function.
I’m using C++.
Here is the error message:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x20): undefined reference to
main’
collect2: error: ld returned 1 exit status
The only puzzle I’ve encountered this problem with.
What should I do?
Hey AchrafLy did you figure out what was the problem with ur solution? i have same issue
In the last Chuck Norris message, when i convert the whole message to a binary message, there are 14 leading zeros that are not taken into consideration.
I then format this binary message to a message that has a 7*MESSAGE.length() character, that means adding 14 leading zeros, the message length is 53 and I get 371 characters including the leading 0.
The problem is in the solution they don’t take the 14 leading zeros into consideration. Anyone had the same problem?
Edit: I got it,the binaries need to be formatted before the concat
Hi…
I can not achieve this puzzle because I don’t know how to convert the input in 7 bits… I’ve currently the following code, which doesn’t work : https://pastebin.com/k03484pS
(sorry for my bad English by the way)
Split your string in chars then write your char (ASCII) in binary.
I translate my chars in binary one a time by getting the cases of a table… I don’t use the String gotten in input
my result for the last Ex is good but codinggame say no
Hey guys, I’m pretty confused rn, in ruby when I use
message.unpack(“B*”)[0]
I get
01000011
Instead of what I expected to be 1000011
Any tips ?
while (mybin.Length<7)
mybin = “0”+mybin;
Hi, I’m coding in c++ and the test tells me my method take too much time, but I don’t find a fastest way to convert it so … here’s my code :
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
using namespace std;
string convertbin(string mes);
string bintoChuck (string mes);
int main()
{
string MESSAGE;
getline(cin, MESSAGE);
string binans = convertbin(MESSAGE);
string ans = bintoChuck(binans);
cout << binans << endl;
}
string convertbin(string mes) {
string bin;
for (int counter = 0; counter < mes.length(); ++counter)
{
char s = mes[counter];
bitset<7> bits(s);
bin += bits.to_string();
}
// Return string passed by arguement
return bin;
}
string bintoChuck(string mes) {
int bigCount(0);
int count(0);
string ans;
do {
if (mes[bigCount] == 1) {
ans += "0 ";
}
else {
ans += "00 ";
}
do {
++count;
} while (mes[bigCount + count] == mes[bigCount]);
for (int i(0); i != count; ++i) {
ans += "0";
}
ans += " ";
bigCount = count;
count = 0;
} while (bigCount != mes.size());
return ans;
}
I’ve made an python oneliner abomination, is there anything to improve?
print(' '.join([['00','0']['1' in ele]+' '+'0'*len(ele) for ele in ''.join(['0'*(7-len(format(ord(chr), 'b')))+format(ord(chr), 'b') for chr in list(input())]).replace('10', '1 0').replace('01', '0 1').split()]))
how do I update my “published” solution?
I have a much more “Kotlinesque” solution from my original
Here’s how to do it:
- go to your original solution and click the button “published” to unpublish it. (I know we should change the label)
- go to your solutions tab, find the latest one and publish it
except that k symbol in ascii is 107 which convert to 1101011 and not 100000… maybe I missed something
Moreover space symbol is 0100000 then is the answer taking the space before the k ? Inversion of symbol in the expected answer maybe ?
We need a better UX with the console please !
Last test, how am I supposed to debug this:
Échec
Trouvé :
0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00 000 0 0000 00 0 0 0 00 0 0 000…
Attendu :
0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00 000 0 0000 00 0 0 0 00 0 0 00 …
Merci
pour convertir un caractère en binaire, il suffit de regarder dans les fonctions natives de python.
ensuite chuck nous a reservé la surprise de du % et de l’espace à formater…
hi, i’m abdeljalil and i’m new here, i began this challenge tree days ago and i’do so well, i make tree function to solve it, but i didint understand why they send me an error, more i didn’t understand message variable, is it the ascii code for the charachters or just the charachters like a string…
Hi guys, I have the same problem,
- solving in Python 3
- I am adding leading “0” at each char if it’s representation is shorter than 7bits
- I also tried with adding missing zeroes at the end of string
but it still doesn’t work for me. I am stuck here. Any ideas, hints?
It works fine for rest test cases.
Thanks!