概述
来源:
http://acm.hdu.edu.cn/showproblem.php?pid=2052
题目:
Picture
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 28276 Accepted Submission(s): 14257
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
+---+ | | | | +---+
题意:输入列数和行数,输出相应的矩形
代码:
#include <iostream>
int main(int argc, const char * argv[]) {
int l,h;
while (scanf("%d%d",&l,&h)==2) {
printf("+");//第一行输出开始
for (int i=0; i<l; i++) {
printf("-");
}
printf("+n");//第一行输出结束
for (int i=0; i<h; i++) {//控制行数
printf("|");
for (int j=0; j<l; j++) {//控制列数
printf(" ");
}
printf("|n");
}//输出结束
printf("+");//尾行输出开始
for (int i=0; i<l; i++) {
printf("-");
}
printf("+n");//尾行输出结束
printf("n");//我是本题坑
}
return 0;
}
最后
以上就是苹果含羞草为你收集整理的HDU2052(水题)Picture Picture的全部内容,希望文章能够帮你解决HDU2052(水题)Picture Picture所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复