hdu2052 Picture(C语言)
来源:互联网 发布:施耐德可编程编程软件 编辑:程序博客网 时间:2024/06/04 18:21
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
+---+| || |+---+
Author
xhd
Source
校庆杯Warm Up
C语言AC代码
#include<stdio.h>int main(){ int i,j,n,m,a[5000]; while(scanf("%d%d",&n,&m)!=EOF) { for(i=0;i<=m+1;i++) { for(j=0;j<=n+1;j++) { if(i==0&&j==0||i==m+1&&j==0||i==0&&j==n+1||i==m+1&&j==n+1) printf("+"); else if((j==0&&i>0&&i<m+1||j==n+1&&i>0&&i<m+1)) printf("|"); else if(i==0&&j>0&&j<n+1||i==m+1&&j>0&&j<n+1) printf("-"); else printf(" "); } printf("\n"); } printf("\n"); } return 0;}心得:题目要绕一个矩形出来,矩形长度n*m,所以注意输出就行了,但是我做得慢了,遇到简单的题,更应当高效地解决,还是要多做题~
阅读全文
0 0
- hdu2052 Picture(C语言)
- HDU2052(水题)Picture
- hdu2052 Picture
- HDU2052 Picture
- HDU2052 Picture
- hdu2052 Picture
- HDU2052 Picture
- hdu2052
- HDU2052
- hdu2052
- HDU2052
- HDU2052(预处理)
- C++/MFC-Picture Control
- 闭包实践(一)------sicp图形语言--picture
- HDOJ-2052(Picture)
- picture
- picture
- picture
- 磁盘读写与数据库的关系
- 对mybatis-generator扩展项目的配置使用介绍
- dubbo项目配置文件错误,出现小红叉的问题
- python学习(二)----字符串常用方法及注释
- 推荐几个学习linux的国外著名论坛网站
- hdu2052 Picture(C语言)
- 每日一发Python---python list转字符串会显示u'的问题
- 计算几何之线段相交问题模板
- sql查询语句27到练习
- [新手入门]什么是量化策略
- 2017 Multi-University Training Contest
- HDU 6053 容斥dp 或 莫比乌斯反演
- Python修改数据中的字符串数据列
- 莫比乌斯函数