PictureTime
limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 19457 Accepted Submission (s): 10008
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.
#include <stdio.h>//#include <stdlib.h> main() { int A,B,C,J,I,K; while (scanf("%d%d",&A,&B)!=Eof ) { for( I=0;I<A+2;I + +) { if( I==0||I==A+1)//printf (");Printf("+"); Else Printf("-"); if (I==A+1)Printf("\ n"); } for ( I=0;I<B;I++) for (J=0;J<A+2;J + +) {if( J==0||J==A+1)Printf("|"); Else Printf(" "); if (J==A+1)Printf("\ n");} for (I=0;I<A+2;I + +) { if( I==0||I==A+1)//printf (");Printf("+"); Else Printf("-"); if (I==A+1)Printf("\ n"); }Printf("\ n"); }//System ("pause");return0; }
[Copy to Clipboard] [Save to File]
Sample Input
3 2
Sample Output
+---+| || | +---+
Picture (Rectangle)