Ad
  • Custom User Avatar

    The real abomination is modern website and OS design and planned obsolescence enacted through willful anti-efficiency. But the 17th ret*=59; overflows unsigned long long anyway. I simply precomputed the final answers, and 24 was still overkill, and now I can see that the last third of even those few are simply wrong.

  • Custom User Avatar

    Excellent kata, approved at average vote of kyu 2!

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Could it be that the Shell tests are broken???

    Please when you post a question, don't post an issue... but a question.

    when in fact there is a valid input.

    Can you give some example: input town + result of the test.
    30 people passed the Shell kata so I am quite sure that tests are not broken.

  • Default User Avatar

    Could it be that the Shell tests are broken??? It is difficult to debug in Shell but from my side it really looks that in several cases the test expects -1 when in fact there is a valid input.

  • Default User Avatar

    I think you missed a couple of braces

  • Default User Avatar

    Nice kata! Would be cool if author made a 4kyu or 3kyu version where every floor is 2D. Another cool option would be to add several stairs at each floor - finding a shortest route would be a quite challenging 3kyu kata.

  • Custom User Avatar

    Please use spoiler flag next time. Your comment is visible from the dashboard.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Default User Avatar

    Voted clever because I have no idea whats going on. Some comments or explanation would be nice though.

  • Default User Avatar

    Thank you very much! I will definately look into it. This might be usefull in some other circumstances.

  • Default User Avatar

    The easiest approach to making a value like this is to write C (or asm) code on your machine, compile it, and copy the hexdump of the function. You need to save it under the same name the function is supposed to be, and make sure you compile (or write, in case of asm code) it as Position Independent Code.
    You can store it in as big as a variable you want to, but you need to get the endianness correct (Array element are stored in sequence, but a long long is stored as chars in reverse!)

  • Default User Avatar

    The code you write gets assembled separetely from the test, so the test only knows the type of something from the type declaration.
    You can write an array / single value in one file, then make a function declaration in another file. This makes the second file treat your value as a function.
    The array I created is a byte code that multiplies the values (that are in two specific registers) and return the result. It doesn't matter that it is an ll array, the second file treats it as a function, so it calls it and it just works.

  • Default User Avatar

    Thanks! Our solutions are basically the same only yours is executed more professionally. I am very new to C++ so my knowledge of string methods and string initalization is lame. Also, I need to adopt object oriented approach in my C++ code. Just like how it is done in your solution.

  • Loading more items...