hdu 2052 Picture
来源:互联网 发布:ios10怎么信任软件 编辑:程序博客网 时间:2024/05/16 04:53
Picture
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 30511 Accepted Submission(s): 15269
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
using namespace std;
int main()
{
int m,n,i,j;
while(cin>>m>>n)
{
for(i=1;i<=n+2;i++)
{
for(j=1;j<=m+2;j++)
{
if((i==1 && j==1)||(i==1 && j==m+2)||(i==n+2 && j==1)||(i==n+2 && j==m+2))
cout<<”+”;
else if((j==1 && i!=1 && i!=n+2) || (j==m+2 && i!=1 && i!=n+2)) cout<<”|”;
else if((i==1 && j!=1 && j!=m+2) || (i==n+2 && j!=1 && j!=m+2)) cout<<”-“;
else cout<<” “;
}
cout<
- hdu 2052 picture
- Hdu 2052 - Picture
- HDU 2052 Picture
- HDU 2052 Picture
- HDU 2052 - Picture
- HDU 2052 Picture
- HDU 2052 Picture
- hdu 2052 Picture
- hdu 2052 Picture(模拟)
- HDU 2052 Picture
- HDU 2052 Picture
- HDU--2052Picture
- HDU--2052 picture
- HDU 2052 Picture
- HDU 2052 Picture
- C++ HDU 2052 Picture
- Hdu 2052 Picture
- hdu 2052 Picture
- 【HDU1754】I hate it!
- 【Docker】在ubuntu14.04镜像上安装GPU显卡驱动, CUDA和CUDNN
- (87)异常日志文件:通过改变标准输出到日志文件
- Chat room (codeforces-58A)
- Spring-task定时任务配置
- hdu 2052 Picture
- Node.js实现注册邮箱激活功能
- 进制转换(十进制数m转换成n进制)
- MFC串口通信串口指示灯的实现
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.1 NoSQL介绍)(草稿)
- FL2440的Linux内核编译出现问题的解决办法
- DM5加密
- Inside the C++ Model第二讲之 成员初始化列表(Member Initialization List)
- iOS GPUImage音视频采集以及美颜功能