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. centos7下安装docker(12.3容器之间的连通性)

    我们接着盗图,如下: 在这张图上,可以看到,如果两个容器使用同一个bridge,那么两个容器之间是互相能通的 可以看到两个容器在同一个bridge下是可以互相ping通的 当两个容器在不同的bridg ...

  2. Spring Boot application starters

    https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#using-boot-dependency-ma ...

  3. Excel各种条件求和的公式汇总

    经常和Execl打交道的人肯定觉得求和公式是大家时常用到的.Excel里有哪几路求和公式呢?他们的使用方式又是怎样?我为大家汇总一下. 使用SUMIF()公式的单条件求和: 如要统计C列中的数据,要求 ...

  4. Windows下面安装并运行composer的步骤

    在composer官网下载得到:https://getcomposer.org/download/ Composer-Setup.exe 安装时注意:安装过程中,会提示你选择php安装目录.一直到ph ...

  5. oracle批量插入数据(测试)

    做数据库开发或管理的人经常要创建大量的测试数据,动不动就需要上万条,如果一条一条的录入,那会浪费大量的时间,本文介绍了Oracle中如何通过一条 SQL快速生成大量的测试数据的方法.产生测试数据的SQ ...

  6. oracle 查询 归档日志最大值和平均值

    select max(ss.size_GB), avg(ss.size_GB)  from (select s.*, rownum rn2          from (select a.*      ...

  7. C++多线程中用临界区控制全局变量的访问冲突问题

    困扰了我很长时间的多线程访问全局变量今天终于解决了,所以得记录一下..控制全局变量的方法很多,有信号量.临界区等..这里我记录一个用临界区控制访问冲突的例子.非常好用. #include <wi ...

  8. sonar6.7.6安装及汉化

    sonar下载地址 https://www.sonarqube.org/downloads/ 下载请选择 然后解压 在目录F:\tools\sonarqube-6.7.6\bin\windows-x8 ...

  9. linux随手笔记(Centos为主)

    用户管理 1.用户管理配置文件 用户数据文件:/etc/passwd [root@CentOS-Test software]# grep test /etc/passwd test:x:500:500 ...

  10. 【POJ 3476】A Game with Colored Balls

    POJ 3476 首先写了个treap,然后常数太大tle了... 然后想了个极为复杂的方法,是一共7个dsu,3个bit,还有一个set.然后写了一半就歇菜了... 然后看dxm的方法,是这样做的: ...