Sherlock and The Beast

  • + 0 comments
    public static void decentNumber(int n) {
            String result = "-1";
            
            if(n%3 == 0) {
                result = "5".repeat(n);
            } else {
                for(int i = 5; i <= n; i+=5) {
                    if((n-i)%3 == 0) {
                        result = "5".repeat(n-i) + "3".repeat(i);
                        break;
                    }
                }
            }
          System.out.println(result);
        }