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

3 2

Sample Output
+---+
| |
| |
+---+

别忘了每一个输出后面空一行

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int m = sc.nextInt();
int n = sc.nextInt(); for(int i=0;i<n+2;i++){ for(int j=0;j<m+2;j++){
if(i==0){
if(j==0||j==m+1){
System.out.print("+");
}else{
System.out.print("-");
}
}else if(i==n+1){
if(j==0||j==m+1){
System.out.print("+");
}else{
System.out.print("-");
}
}else {
if(j==0||j==m+1){
System.out.print("|");
}else{
System.out.print(" ");
}
}
}
System.out.println();
}
System.out.println(); } } }

HDOJ 2052 Picture的更多相关文章

  1. hdu 2052 Picture(java)

    问题: 開始直接用输入的数作为宽和高,但实际上要多出两行边框,所以要加一个2. 还有题目要求最后要输出一个空行没有注意到. Picture Time Limit: 1000/1000 MS (Java ...

  2. 杭电ACM 2052 Picture

    Picture Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  3. HDU 2052 Picture

    http://acm.hdu.edu.cn/showproblem.php?pid=2052 Problem Description Give you the width and height of ...

  4. HDUJ 2052 Picture 模拟

    Picture Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  5. 杭电oj2047-2049、2051-2053、2056、2058

    2047  阿牛的EOF牛肉串 #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d" ...

  6. hdoj 1162 Eddy's picture

    并查集+最小生成树 Eddy's picture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  7. hdoj:2052

    #include <iostream> #include <string> using namespace std; int main() { int n, m; while ...

  8. HDOJ 题目2475 Box(link cut tree去点找祖先)

    Box Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  9. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

随机推荐

  1. JS 模拟C# 字符串格式化操作

    /*** ** 功能: 字符串格式化替换操作 ***/ String.prototype.format = function () { var args = arguments; return thi ...

  2. sqlserver 时间 格式化

    0   或   100   (*)     默认值   mon   dd   yyyy   hh:miAM(或   PM)       1   101   美国   mm/dd/yyyy       ...

  3. .net 使用AjaxControlToolkit.dll 遇到的"Sys"未定义问题

    1.配置文件一般都会缺少<httpHandlers></httpHandlers> 这一段, <httpHandlers> <remove verb=&quo ...

  4. basicAnimation移动图形

    目的:采用CABasicAnimation  点击屏幕上的点来是实现图像的位置移动  并且位置能够不反弹 难点:1 通过动画的KeyPath找到layer的属性 2 通过NSValue将点包装成对象 ...

  5. C#堆栈原理(我有两个例子测试你到底会不会)

    背景 上次写了一篇文章关于try finnally的一些疑问(被我用windows live覆盖了,草),后来经过大神们解释,我明白了在我理解了try.finnally运行原理后,还欠缺的就是关于值类 ...

  6. HTML页面中启用360浏览器极速模式

    今天做页面突然遇到浏览器一直在兼容模式下运行,体验不好,通过查询文档,在<head>中加入<meta name="renderer" content=" ...

  7. Html禁止粘贴 复制 剪切

    oncopy="return false;" onpaste="return false;" oncut="return false;"

  8. easyui tree 判断点击的节点是否还存在子节点

    有些业务需求是要求tree一次性全部加载,有些是需要异步加载的. 如果是一次性全部加载的tree,那怎么判断点击的节点是否还存在子节点? function loadTree(){ $('#tree') ...

  9. javascript常用代码大全

    http://caibaojian.com/288.html    原文链接 jquery选中radio //如果之前有选中的,则把选中radio取消掉 $("#tj_cat .pro_ca ...

  10. Python自动化运维之26、Web框架本质、MVC与MTV

    一.Web框架本质 众所周知,对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端. #!/usr/bin/env python #coding:ut ...