Sherlock and The Beast

  • + 0 comments

    Python 3, all test cases passed. Simple and understandable solution.

    def decentNumber(n):
        three = 0
        five = n
        while five > 0 and five%3 != 0:
            three += 5
            five -= 5
        if five < 0:
            print(-1)
        else:
            print(int('5'*five + '3'*three))