Sherlock and The Beast

  • + 0 comments

    python 3

    def decentNumber(n):
        fives = n
        threes = 0
        
        while fives >= 0:
            if fives % 3 == 0 and threes % 5 == 0:
                break
            else:
                fives -= 1
                threes += 1
        print(-1 if fives < 0 else ('5' * fives) + ('3' * threes))