Problem:
Start directly with the number of inputs as wide and high, but actually more than two lines of border, so add a 2.
There are also topics that require the final output of a blank line that is not noticed.
PictureTime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 19789 Accepted Submission (s): 10178
Problem descriptiongive you the width and height of the rectangle,darw it.
Inputinput contains a number of test cases. For each case, there is numbers n and m (0 < N,m < rectangle) indicate the width and height of the. Iuput ends of EOF.
Outputfor each case,you should draw a rectangle with the width and height giving in the input.
After the case, you should a blank line.
Sample Input
3 2
Sample Output
+---+| || | +---+
Code:
Import java.util.*;p ublic class main{public static void N1 (int t) {String s= ""; for (int i=1;i<=t;i++) {if (i==1| | i==t) s=s+ "+"; elses=s+ "-";} System.out.println (s);} public static void N2 (int t) {String s= "", for (int i=1;i<=t;i++) {if (i==1| | i==t) s=s+ "|"; Elses=s+ "";} System.out.println (s);} public static void Main (string[] args) {Scanner cin=new Scanner (system.in), while (Cin.hasnext ()) {int n=cin.nextint (); int m=cin.nextint (); int t=n+2;for (int i=0;i<m+2;i++) {if (i==0| | I==M+1) n1 (t); Elsen2 (t);} System.out.println ();}}}
HDU 2052 Picture (Java)