Sherlock and The Beast

  • + 0 comments

    python3

    def decentNumber(n):
        # Write your code here
        
        t = n - n % 3
        found = False
        
        while t >= 0 and not found:
            if (n - t) % 5 == 0:
                found = True
            else:
                t = t - 3
    
        print("5" * t + "3" * (n-t)) if found else print(-1)