Result

AC

Duration

2034ms

Code [DL]

interface A{static void main(String[]a){var s=new java.util.Scanner(System.in);for(int h=s.nextInt(),w=s.nextInt(),y=h;;)System.out.println("*"+(y%h>y/y--?" ":"*").repeat(w-2)+"*");}}

stdin

20
35

stdout

***********************************
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
*                                 *
***********************************

stderr

Exception in thread "main" java.lang.ArithmeticException: / by zero
	at A.main(A.java:1)