codevs——1276 图标缩放
You have been asked to take a small icon that appears on the screen of a smart telephone and scale it up so it looks bigger on a regular computer screen.
你被要求把手机上的小图标变成电脑上的大的。
The icon will be encoded as characters (x and *) in a 3 × 3 grid as follows:
小图标是:
*x*
xx
* *
Write a program that accepts a positive integer scaling factor and outputs the scaled icon. A scaling factor of k means that each character is replaced by a k × k grid consisting only of that character.
写一个程序把它每一个字符都变成k*k的
The input will be a positive integer k such that k < 25.
输入会是一个正整数k,k<25。
The output will be 3k lines, which represent each individual line scaled by a factor of k and repeated k times. A line is scaled by a factor of k by replacing each character in the line with k copies of the character.
输出会是3k行,详见样例。
3
***xxx***
***xxx***
***xxx***
xxxxxx
xxxxxx
xxxxxx
*** ***
*** ***
*** ***
按照题目要求的缩进
水!
代码
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int n;
int read()
{
int x=0,f=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
int main()
{
n=read();
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<"*";
for(int i=1;i<=n;i++)
cout<<"x";
for(int i=1;i<=n;i++)
cout<<"*";
cout<<endl;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<" ";
for(int i=1;i<=n;i++)
cout<<"x";
for(int i=1;i<=n;i++)
cout<<"x";
cout<<endl;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<"*";
for(int i=1;i<=n;i++)
cout<<" ";
for(int i=1;i<=n;i++)
cout<<"*";
cout<<endl;
}
return 0;
}
codevs——1276 图标缩放的更多相关文章
- 点击按钮后到底发生了什么,Touch,LongClick或者Click?
按钮点击事件详解 最近一个项目需要给应用初始界面上的动态按钮添加在不同状态的变换效果,如点击(俗一点也可称为按压)后实现背景图的更换或者图标的缩放等效果.由于按钮点击的时间有长有短,所以采用OnTou ...
- 【Unity】2.5 场景视图(Scene)
分类:Unity.C#.VS2015 创建日期:2016-03-29 一.场景视图(Scene View)导航 场景视图 (Scene View) 是你的交互式沙箱.你可以使用场景视图 (Scene ...
- JS 百度地图 地图线路描绘
JS 百度地图 地图线路描绘 <script type="text/javascript" src="http://api.map.baidu.com/api?v= ...
- GPS坐标显示在百度地图上(Qt+百度地图)
Qt在5.6以后的版本就不支持webview控件了,这里我用的是Qt5.4的版本,里面还有这个控件: 下面简单介绍下Qt与html中的javascript调用交互过程: 一.整体实现介绍 在html中 ...
- Android自己定义百度地图缩放图标
自己定义实现Android百度地图的缩放图标,须要自己定义一个缩放控件,实现效果例如以下: 这里的缩放效果,实现了点击button能够对地图的放大缩小,通过手势放大与缩小也控制缩放图标的可用状态.详细 ...
- 简单的css缩放动画,仿腾讯新闻的分享按钮和美团app底部的图标样式
最近看到一些好看的hover的图形缩放效果.然后自己就写了下,发现这2种效果都不错.如果伙伴们更好的实现方式可以在下面留言哦~ 还有美团的效果,我就不展示了,喜欢的可以去app应用上看看. 这两种效果 ...
- Font Awesome可缩放的矢量图标
我感觉图标还行~~~这里是我修改过的,自己根据需要修改即可~~ 网址: http://fontawesome.dashgame.com/ 使用: <link rel="styleshe ...
- 一个标签的72变,打造一个纯CSS图标库
每次要用到图标的时候都会到 icono 去copypaste,但每次用到的时候尺寸都各不一样,总是要调整参数,巨烦.当然你可以会想到用zoom.scale来做缩放,但是这样的缩放会使得线宽也变粗了,不 ...
- 纯JS打造比QQ空间更强大的图片浏览器-支持拖拽、缩放、过滤、缩略图等
在线演示地址(打开网页后,点击商家图册): http://www.sport7.cn/cc/jiangnan/football5.html 先看一看效果图: 该图片浏览器实现的功能如下: 1. 鼠标滚 ...
随机推荐
- @GetMapping和@PostMapping 和@RequestMapping区别
@GetMapping 用于将HTTP GET请求映射到特定处理程序方法的注释. 具体来说,@GetMapping是一个作为快捷方式的组合注释@RequestMapping(method = Requ ...
- dotnet cors 跨域问题
研究了一整子的.net core框架,感觉挺好用的,可以用在实际项目中,前端avalon框架也在研究: 问题:跨域,相比原来的跨域解决方案,还是有不小的变化的,原来的.net api 只需要在WebA ...
- Android BitmapFactory.decodeFile(filePath, options) 返回 Null 6.0权限
今天在做拍照上传的时候遇到个问题,根据路径获取Bitmap 失败,一直返回空,以为这个路径获取Bitmap代码久经考验,不怀疑它,找参数传入是否正确,初步怀疑是 filePath 没传进去,打印 fi ...
- spark 学习路线及参考课程
一.Scala编程详解: 第1讲-Spark的前世今生 第2讲-课程介绍.特色与价值 第3讲-Scala编程详解:基础语法 第4讲-Scala编程详解:条件控制与循环 第5讲-Scala编程详解:函数 ...
- list map接口传递
1.传参时可以设置为jsonArray的格式 JSONArray array = new JSONArray(); JSONObject json = new JSONObject(); json.p ...
- js 异步提交文件
<form method="POST" action="${ctx}/statement/manage/upload" name="form&q ...
- java关于时间的相关操作
/** * 获取当天时间零点 * @return */ public Date gettoday(){ SimpleDateFormat sdf = new SimpleDateFormat(&quo ...
- JS、CSS、Image预加载
Image预加载 <div class="hidden"> <script type="text/javascript"> var im ...
- linux 服务脚本
#!/bin/bash # # chkconfig: # description: my_SERVICE_NAME is a my Service # # common function . /etc ...
- [BZOJ] 2431 逆序对数列
Time Limit: 5 Sec Memory Limit: 128 MB Submit: 2611 Solved: 1526 [Submit][Status][Discuss] Descripti ...