chuck norrix
Y wonder the same >=/, damn headache
The validator stops at the first character that isnāt as expected and only shows the output so far. Itās not a āfinal spaceā, there is additional output after the space.
OH my god! Thank you so much. Took me half a second to complete 100% after reading this! Thank you!
I am not certain the expected output for Test No. 3 (the %) is correct.
According to the output, it expects a 1011010
to be NorrisEncoded, but the binary representation of % is 0100101
. If I put it this way, it will look different
1011010
0100101
Rest of the tests pass, so I assume, that the expected result for % test is buggy.
My code passes the 1st and 3rd tests, but 2 and 4 I get:
Process has timed out. This may mean that your solution is not optimized enough to handle some cases.
I didnāt think my code was that long, it just converts the ASCII text into their respective character code, then concatenates all of them into a binary string. I parse the binary string using a series of if-else statements to convert it to Chuckās code. Iām guessing thereās a more efficient way to do this. Can somebody tell me what algorithm they used that worked?
Can anyone please take a look at my code? It passes the first three tests, but the fourth test doesnāt work.
[EDIT: NO FULL CODE]
Thereās something weird with my code. First, i wrote it on codeblock (iām working in C); works well. But when i copy it on CodinGame, it gave me 2 extra ā0ā et the end -_-
Iāve managed to make it work, but i donāt understand: why? The code is the same! Where does thoses 00 comes from?
Still, the first step is done. For the second one, thought, iām stuck with a segmentation fault. Since iām not so good with sizes and segmentation, iāll love to have you get a look at this, cause i really donāt see the problem:
TUnaire[k+1]='\0'; //that was to kill the extra 0
TailleTotale+=(k+1)*sizeof(char); //TailleTotale=0 at the beginning of my code
if(l==0){ //it is the case
Total=malloc(TailleTotale);
strncpy(Total, TUnaire, k); //SEGMENTATION FAULT! WHY?
}
else{ //i don't enter this case for now, but i guess it'll have the same problem
Total=realloc(Total,TailleTotale);
strcat(Total, TUnaire);
}
l++;
}
printf("%s\n", Total);
I really donāt get it. TUnaire is a char* which contain k+1 char, Total is an empty char* and i alloc it (k+1)*sizeof(char) spaceā¦Why the first one canāt copy in the second? Iāve even tried to copy only the first k characters of TUnaire, but that still donāt work.
Please help (
Itās hard to say without seeing the full code, but:
Does k
have a sensible value? Moreover, if TUnaire
can contain k+1 chars as you wrote it, TUnaire[k+1]
is one past the end of TUnaire[]
(and itās an error).
Check the return value of malloc (Total != NULL
).
Either Total
or TUnaire
are not valid pointers, or k
is negative or too large, or there is bug elsewhere in your code.
why string.Length is not working in the IDE but is working in monodevelop IDE, I mean, I wrote the same code as did in monodevelop but in codingame IDE does not work, example :
-
monodevelop:
while(index != binary.Length - 1 ){ index++; n = binary.ElementAt (index); if(n.Equals('1')) Console.Write (binary.ElementAt (index)); }
it works, but itās not in codingame IDE.
i have a probel with the last test and i donāt know whatās wrong -___-
chuck norrisās msg is sooo strong xDD
i have the same problem xD
i donāt know whatās wrong!! but when it came to āspaceā it give me a problem!
like 000 and expected 00 0
i corrected my problem xD
thx me :v
I got the same problemā¦ How did you fix it?
Pls help! :ā(
My program gives what the site wait in the C test: 0 0 00 0000 0 00
But the program says:
Failure
Found:
Expected: Nothing
Why??? I do not add a space to the end of the result string. What did i do wrong? Pls help! :ā(
Maybe you are printing some extra char. Certify that you print only the answer and you can print a new line (\n) at end.
No, iām not. I asked for help in the chat, but we couldnāt figure it out. I sent them my code, one guy told me, itās working, but in an other guy computer my code made the same error.
I tried solve the first one this way: echo(ā0 0 00 0000 0 00\nā);
But it writes the same error:
Failure
Found: " "
Expected: Nothing
This echo worked for me. If you want send me your code to test here.
echo("0 0 00 0000 0 00\n");
This code works for me.
Check you php code, it has be exactly this:
<?php echo("0 0 00 0000 0 00\n");
No new line before the <?php
, and don,'t use the ?>
. This way youāll be sure thereās no extra characters in the ouput.