Triangle Quest 2

  • + 0 comments

    I HATED this challenge.

    I would have saved a lot of time if the compiler error messages were more clear. At first, I got an error about using str(). Then, many times I got error messages about using more than one print() or for statement. I was using only one of each, but it turns out that if a comment in the code mentioned either of those keywords, it would cause the error, too! FFS!

    Finally, I got past those errors when I realized I should remove the comments. Then I got an error message about using a "string literal". I was using sep='\n' in the print() statement. Even that is considered to be "related to strings". FFS!

    Anyway, my inelegant solution is…

    for i in range(int(input())):
        print(123456789 // 10**(8 - i) * 10**(i) + 87654321 % 10**(i))
    

    Not as neat as the problem setter's code, but I think it's fairly unique.