Structured Program I – Print a Frame
题目描述
Print a Frame
Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.
##########
#........#
#........#
#........#
#........#
##########
输入
The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.
The input ends with two 0 (when both H and W are zero).
输出
For each dataset, print the frame made of ‘#’ and ‘.’.
Print a blank line after each dataset.
题解
#include<bits/stdc++.h>
using namespace std;
int main()
{int a,b;while(scanf("%d %d",&a,&b)!=EOF){if(a==0&&b==0)break;for(int i=1;i<=a;i++){if(i==1||i==a){for(int j=0;j<b;j++){cout<<"#";}cout<<endl;}else{for(int j=1;j<=b;j++){if(j==1||j==b)cout<<"#";elsecout<<"."; }cout<<endl;} }cout<<endl;} return 0;
}
相关
Structured Program I – Print a Frame相关推荐
- python变量值发生变化时输出语句_有一个字符串变量s = 'python program',语句print(s[1:5:2]) 的输出结果是:_学小易找答案...
[判断题]print('936'.isdigit()) 的输出结果是 True [单选题]下面关于"义务论"伦理学和"后果论"伦理学的比较描述错误的一项是?() ...
- 看懂nfl定理需要什么知识_NFL球队为什么不经常通过?
看懂nfl定理需要什么知识 Debunking common NFL myths in an analytical study on the true value of passing the bal ...
- Introduction to Programming I
Keyclack posters by Mohamed Chahin 获得更好的阅读体验请访问 Introduction to Programming I Acquire fundamental el ...
- 数字图像处理实验(1):PROJECT 02-01, Image Printing Program Based on Halftoning
实验要求: Image Printing Program Based on Halftoning Objective: To know in principle what is "halft ...
- 如何让精灵在不同的帧率下运动速度不变--Frame Rate Independent Movement
本文性质:翻译加原创,转载请保留原作者和译者信息! 行文安排:前不份是翻译,后部分是自己的原创. Frame Rate Independent Movement by Ben Dilts 翻译Kevi ...
- 【从零开始的ROS四轴机械臂控制】(六)- 逻辑控制节点
[从零开始的ROS四轴机械臂控制(六)] 九.逻辑控制节点 1.运动控制方法 (1)逆向运动学 (2)反馈控制 2.各节点之间的联系 3.相关程序 (1)img_process节点 (2)arm_co ...
- java servlet_Java Servlet的前100个问题
java servlet 1)是" servlets"目录还是" servlet"目录? 回答: 对于Java Web Server: 在文件系统上,它是&qu ...
- Java Servlet的前100个问题
1)是" servlets"目录还是" servlet"目录? 回答: 对于Java Web Server: 在文件系统上,它是" servlet&q ...
- C语言编程规范--常用缩写词
常用缩写词 缩 写 全 称 a addr address admin / adm administrator app application arg argument asm assemble asy ...
最新文章
- SpringCloud(第 029 篇)配置客户端 ConfigClient 接入配置服务端
- 【Python基础】玩一玩python第三方进度条库tqdm
- SpringAMQP--FanoutExchange
- 数据结构与算法--死磕二叉树
- 函数指针,指针函数,函数指针数组
- Linux 程序后台运行与删除
- linux 网络状态图,linux的网络连接状态
- 对于python的感受_聊聊我对python的感受
- 雷军:小米生死靠技术!
- 如何用jQuery获得radio的值
- 7-110 自动售货机 (30 分)
- 区块链 PBFT 哪个节点 谁负责打包区块
- 空间旋转矢量的求法(理解)
- 《暗时间》读书笔记与读后感
- HP M1136无法打印的解决方法
- 实现用户分层的手段——RFM模型
- 您所说的话:您如何与Bacn打交道
- Kaggle时间序列(Time Series)教程 6-使用机器学习预测(forecasting-with-machine-learning)
- 东大《工厂供电及节能技术Ⅰ》在线平时作业1
- Cocos Creator苹果应用商城上架指南
热门文章
- 计算机通电后 不能正常启动,我的电脑通电后不能马上启动?为什么啊?怎么办
- Word2007/2003常用快捷键
- 微信小程序 navigator 导航
- 给父元素添加点击事件时,获取到的 event.target 为子元素(point-events: none 的妙用)
- 判断当前音效是否播放完毕
- 用JS做一个简易的时间显示动态效果
- 健康菜谱微信小程序+项目前后台源码(JavaSSM+Mysql)
- 车联网真要来了?全球汽车网络安全市场将实现跨越式增长
- 先知ppt_用先知预测时间序列数据–第3部分
- facebuilder免费版_FaceBuilder 2.1.1 For Blender 2.8x-2.9x脸头部照片建模纹理插件