hdu2052
来源:互联网 发布:oracle的sql developer 编辑:程序博客网 时间:2024/05/16 06:05
Picture
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 23002 Accepted Submission(s): 11710
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.
after each case, you should a blank line.
Sample Input
3 2
Sample Output
+---+| || |+---+
遇到的问题和解题思路:
水题。不过记住要每组数据之间空一行。(you should a blank line.)。
给出代码:
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int n,m;
char a[100][100];
int main(){
while(scanf("%d%d",&n,&m)!=EOF){
for(int i = 1;i <= m+2;i++){
for(int j = 1;j <= n+2;j++){
if((i == 1||i == m+2)&&(j == 1||j == n+2))a[i][j] = '+';
else if((i == 1||i == m+2)&&j > 1&&j < n+2)a[i][j] = '-';
else if((j == 1||j == n+2)&&i > 1&&i < m+2)a[i][j] = '|';
else a[i][j] = ' ';
}
}
for(int i = 1;i <= m+2;i++){
for(int j = 1;j <= n+2;j++){
printf("%c",a[i][j]);
}
printf("\n");
}
printf("\n");
}
return 0;
}
0 0
- hdu2052
- HDU2052
- hdu2052
- HDU2052
- hdu2052 Picture
- HDU2052(预处理)
- HDU2052 Picture
- HDU2052 Picture
- hdu2052 Picture
- HDU2052 Picture
- HDU2052(水题)Picture
- hdu2052 Picture(C语言)
- HDU2052 大水题 做图片相框
- HDU_Steps9.2 杂题 HDU2052 HDU1871 HDU1254 HDU3350 HDU3234 HDU2642 HDU2833 HDU3483
- play maven依赖管理及本地组件开发
- Android 一个改善的okHttp封装库
- 电脑装xp系统不能开机,装win7却正常!
- 数组中子数组的最大累乘积
- SpringMVC中@ResponseBody注解返回json中文乱码问题
- hdu2052
- php类库安装xml
- iOS UIView初识
- Android AutoLayout全新的适配方式 堪称适配终结者
- 【LeedCode】328. Odd Even Linked List
- iOS设备、Icon、LaunchImage、图片分辨率
- windows server 部署负载均衡
- DataTable序列化和反序列化
- 新建一个线程去运行下载数据或数据查询的操作