523A Rotate, Flip and Zoom
2015-03-16 22:40
267 查看
A. Rotate, Flip and Zoom
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line,
that is, the right part of the image moves to the left, and vice versa) and zooming on the image. He is sure that that there is a large number of transformations that can be expressed through these three.
He has recently stopped implementing all three transformations for monochrome images. To test this feature, he asked you to write a code that will consecutively perform three actions with a monochrome image: first it will rotate the image 90 degrees clockwise,
then it will flip the image horizontally and finally, it will zoom in twice on the image (that is, it will double all the linear sizes).
Implement this feature to help Polycarp test his editor.
Input
The first line contains two integers, w and
h (1 ≤ w, h ≤ 100) — the width and height of an image in pixels. The picture is given in
h lines, each line contains
w characters — each character encodes the color of the corresponding pixel of the image. The line consists only of characters "." and "*", as the image is monochrome.
Output
Print 2w lines, each containing
2h characters — the result of consecutive implementing of the three transformations, described above.
Sample test(s)
Input
Output
Input
Output
题意:给一个图片,宽m,高n,然后顺时针转90度,左右翻转,左右上下都扩大两倍,打印输出。
思路:我创建了两个数组,一个记录输入,其实是为了测试用,可以不创建的。第二个数组是第一个数组是行时第二个是列,第一个是列时第二个是行,而且第一个图一个点a【i】【j】,第二个就要图b【2*i】【2*j】,b【2*i+1】【2*j】,b【2*i】【2*j+1】,b【2*i+1】【2*j+1】四个点,输出就是了。真奇怪居然就这么对了,,跟着感觉走啊感觉走
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line,
that is, the right part of the image moves to the left, and vice versa) and zooming on the image. He is sure that that there is a large number of transformations that can be expressed through these three.
He has recently stopped implementing all three transformations for monochrome images. To test this feature, he asked you to write a code that will consecutively perform three actions with a monochrome image: first it will rotate the image 90 degrees clockwise,
then it will flip the image horizontally and finally, it will zoom in twice on the image (that is, it will double all the linear sizes).
Implement this feature to help Polycarp test his editor.
Input
The first line contains two integers, w and
h (1 ≤ w, h ≤ 100) — the width and height of an image in pixels. The picture is given in
h lines, each line contains
w characters — each character encodes the color of the corresponding pixel of the image. The line consists only of characters "." and "*", as the image is monochrome.
Output
Print 2w lines, each containing
2h characters — the result of consecutive implementing of the three transformations, described above.
Sample test(s)
Input
3 2 .*. .*.
Output
.... .... **** **** .... ....
Input
9 20 **....... ****..... ******... *******.. ..******. ....****. ......*** *.....*** ********* ********* ********* ********* ....**... ...****.. ..******. .******** ****..*** ***...*** **.....** *.......*
Output
********......**********........******** ********......**********........******** ********........********......********.. ********........********......********.. ..********......********....********.... ..********......********....********.... ..********......********..********...... ..********......********..********...... ....********....****************........ ....********....****************........ ....********....****************........ ....********....****************........ ......******************..**********.... ......******************..**********.... ........****************....**********.. ........****************....**********.. ............************......********** ............************......**********
题意:给一个图片,宽m,高n,然后顺时针转90度,左右翻转,左右上下都扩大两倍,打印输出。
思路:我创建了两个数组,一个记录输入,其实是为了测试用,可以不创建的。第二个数组是第一个数组是行时第二个是列,第一个是列时第二个是行,而且第一个图一个点a【i】【j】,第二个就要图b【2*i】【2*j】,b【2*i+1】【2*j】,b【2*i】【2*j+1】,b【2*i+1】【2*j+1】四个点,输出就是了。真奇怪居然就这么对了,,跟着感觉走啊感觉走
#include<iostream> #include<cstdio> #include<cstring> #include<ctime> #include<algorithm> #include <map> #include <queue> using namespace std; //523A int n,m; char a[100][100]; char b[200][200]; int main() { while(true) { cin>>n>>m; for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { cin>>a[i][j]; b[2*j][2*i]=b[2*j][2*i+1]=b[2*j+1][2*i]=b[2*j+1][2*i+1]=a[i][j]; } } for(int i=0;i<=2*n-1;i++) { for(int j=0;j<=2*m-1;j++) { cout<<b[i][j]; } cout<<endl; } } return 0; }
相关文章推荐
- A. Rotate, Flip and Zoom(VK Cup 2015 - Qualification Round 2 简单模拟)
- [Python] Python 旋转、flip Nifti三维数据 (Python Rotate and Flip Nifti volume)
- Direct2D Intro - Flip and Rotate a Bitmap Source
- Using GDI+ in a Single Document MFC Project to Rotate, Zoom, and Constraint an Image
- How.To.Process.Image.Infomation.Of.Rotate.And.Flip.From.Server
- [Python] Python 旋转、flip Nifti三维数据 (Python Rotate and Flip Nifti volume)
- JOJ 1051: Flip and Shift 解题报告
- Latches and flip-flops----锁存器和触发器
- 常用的像素操作算法:Resize、Flip、Rotate
- kibana uses openStreetMap and Gaode map with higher zoom level
- read file in kernel (flip_open and flip_close)
- 实现图片的移动和缩放的功能类(move and zoom)
- Correct Smartphone Video Orientation and How To Rotate iOS and Android Videos with ffmpeg
- iphone dev 入门实例6:How To Use UIScrollView to Scroll and Zoom and Page
- POJ 3106 Flip and Turn 笔记
- CutandZoom 图片剪切类
- poj 1063 Flip and Shift 冒泡排序的扩展运用
- [zz]Flip and Shift -- POJ 1063 解题报告
- zoj 1028 Flip and Shift
- Flip and Shift(ZJU_1028)