【杭电oj206】Picture

桃扇骨 2022-09-25 06:29 352阅读 0赞

Picture

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 25060 Accepted Submission(s): 12778

Problem Description

Give you the width and height of the rectangle,darw it.

Input

Input contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.

Output

For each case,you should draw a rectangle with the width and height giving in the input.
after each case, you should a blank line.

Sample Input

  1. 3 2

Sample Output

  1. +---+
  2. | |
  3. | |
  4. +---+

Author

xhd

Source

校庆杯Warm Up

Recommend

linle | We have carefully selected several similar problems for you: 2051 2054 2072 2053 2055

  1. #include<stdio.h>
  2. int main() {
  3. int n,m;
  4. while(scanf("%d %d",&n,&m)!=EOF) {
  5. for(int i=0; i<n+2; i++)
  6. if(i==0||i==n+1)
  7. printf("%c",'+');
  8. else
  9. printf("%c",'-');
  10. printf("\n");
  11. for(int j=0; j<m; j++) {
  12. for(int i=0; i<n+2; i++)
  13. if(i==0||i==n+1)
  14. printf("%c",'|');
  15. else
  16. printf(" ");
  17. printf("\n");
  18. }
  19. for(int i=0; i<n+2; i++)
  20. if(i==0||i==n+1)
  21. printf("%c",'+');
  22. else
  23. printf("%c",'-');
  24. printf("\n\n");
  25. }
  26. return 0;
  27. }

发表评论

表情:
评论列表 (有 0 条评论,352人围观)

还没有评论,来说两句吧...

相关阅读