codevs——1276 图标缩放
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 图标缩放的主要内容,如果未能解决你的问题,请参考以下文章
在 webview_flutter 中启用捏合和缩放,在哪里添加代码片段 [this.webView.getSettings().setBuiltInZoomControls(true);]
音频处理Melodyne 网络缩放功能 ( 音符分离线 | 片段分离线 | 窗口滚动条 | 网格缩放 | 修改图像显示位置 | 显示五线谱 )