http://acm.hdu.edu.cn/showproblem.php?pid=2052

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
+---+
|      |     
|      |
+---+
 
代码:

#include <bits/stdc++.h>

using namespace std;

int a[100][100];
int len; int main()
{
int n,m;
while(cin>>m>>n)
{
for(int i=1; i<=n+2; i++)
{
if(i==1||i==n+2)
for(int j=1; j<=m+2; j++)
{
if(j==1)
cout<<"+";
else if(j==m+2)
cout<<"+"<<endl;
else
cout<<"-";
}
else
for(int j=1; j<=m+2; j++)
{
if(j==1)
cout<<"|";
else if(j==m+2)
cout<<"|"<<endl;
else
cout<<" ";
}
}
cout<<endl;
}
return 0;
}

  

HDU 2052 Picture的更多相关文章

  1. hdu 2052 Picture(java)

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

  2. HDU 1828 Picture(长方形的周长和)

    HDU 1828 Picture 题目链接 题意:给定n个矩形,输出矩形周长并 思路:利用线段树去维护,分别从4个方向扫一次,每次多一段的时候,就查询该段未被覆盖的区间长度,然后周长就加上这个长度,4 ...

  3. HDU 1828 Picture(线段树扫描线求周长)

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

  4. hdu 1828 Picture(线段树 || 普通hash标记)

    http://acm.hdu.edu.cn/showproblem.php?pid=1828 Picture Time Limit: 6000/2000 MS (Java/Others)    Mem ...

  5. HDU 1828 Picture (线段树+扫描线)(周长并)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1828 给你n个矩形,让你求出总的周长. 类似面积并,面积并是扫描一次,周长并是扫描了两次,x轴一次,y ...

  6. 杭电ACM 2052 Picture

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

  7. 51nod 1206 && hdu 1828 Picture (扫描线+离散化+线段树 矩阵周长并)

    1206 Picture  题目来源: IOI 1998 基准时间限制:2 秒 空间限制:131072 KB 分值: 160 难度:6级算法题  收藏  关注 给出平面上的N个矩形(矩形的边平行于X轴 ...

  8. hdu 1828 Picture 切割线求周长

    Picture Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Sub ...

  9. HDUJ 2052 Picture 模拟

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

随机推荐

  1. swift函数的调用约定

    The convention of the function, indicated by the attribute. This is similar to the language-level @c ...

  2. centos7下安装docker(5镜像命名)

    1.前面我制作了很镜像,利用docker images可以看到我自己制作的所有的镜像 第一列  是我利用docker build -t 镜像名   制作镜像指定的镜像名,但是它对应的是REPOSITO ...

  3. 转://oracle 11gR2 oracle restart 单机使用asm存储 主机名发生更改处理过程

    oracle 11gR2 oracle restart 单机使用asm存储 主机名发生更改并且主机重启后处理过程: 以下为解决方案: 1. Remove Oracle Restart configur ...

  4. !important的用法

    如果写成:a{color:teal !important},IE6和其它高版本浏览器都认识,(IE6虽然不认识!important,但它还是能够认识!important之前的color:teal这个属 ...

  5. metamask源码学习-metamask-controller.js

    The MetaMask Controller——The central metamask controller. Aggregates other controllers and exports a ...

  6. python3 列表的赋值和深浅拷贝

    '''列表赋值:不会创建新对象两个列表的内存地址一样'''# lst1 = ["apple", "banana", ["blueberry" ...

  7. 导入其他python文件或者python文件的函数

    from abc import xxx 从abc的py文件导入一个具体的函数或者类 import abc 直接导入文件 a.b写在同一个文件目录下,a要使用b,直接import就可以了

  8. define和const的一点点小知识

    define篇 1.#define 的作用 在C或C++语言源程序中允许用一个标识符来表示一个字符串,称为“宏”. 被定义为“宏”的标识符称为“宏名”. 在编译预处理时,对程序中所有出现的“宏名”,都 ...

  9. Luogu3676 小清新数据结构题 动态点分治

    传送门 换根类型的统计问题动态点分治都是很好做的. 设所有点的点权和为$sum$ 首先,我们先不考虑求$\sum\limits_i s_i^2$,先考虑如何在换根的情况下求$\sum\limits_i ...

  10. linux ssh修改 默认22端口

    修改ssh 配置  /etc/ssh/sshd_config service sshd restart