HDU 2052 Picture (Java)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.