A. Rotate, Flip and Zoom(VK Cup 2015 - Qualification Round 2 简单模拟)
2015-04-01 21:20
387 查看
A. Rotate, Flip and Zoomtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp 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.InputThe 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 hlines, 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.OutputPrint 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
********......**********........******** ********......**********........******** ********........********......********.. ********........********......********.. ..********......********....********.... ..********......********....********.... ..********......********..********...... ..********......********..********...... ....********....****************........ ....********....****************........ ....********....****************........ ....********....****************........ ......******************..**********.... ......******************..**********.... ........****************....**********.. ........****************....**********.. ............************......********** ............************......**********
#include<iostream>#include<algorithm>#include<stdio.h>#include<string.h>#include<stdlib.h>#include<queue>#include<stack>using namespace std;char map[210][210];char mm[210][210];int n,m;int main(){ while(scanf("%d%d",&m,&n)!=EOF) { for(int i=0;i<n;i++) { scanf("%s",mm[i]); } for(int i=0;i<m;i++) { int k = 0; for(int j=n-1;j>=0;j--) { map[i][k++] = mm[j][i]; } map[i][k] = '\0'; } for(int i=0;i<m;i++) { for(int j=n-1;j>=0;j--) { printf("%c%c",map[i][j],map[i][j]); } printf("\n"); for(int j=n-1;j>=0;j--) { printf("%c%c",map[i][j],map[i][j]); } printf("\n"); } } return 0;}
相关文章推荐
- 523A Rotate, Flip and Zoom
- codeforces 283A - Cows and Sequence 简单数据结构模拟
- POJ 3106 Flip and Turn 模拟 分析
- 【hihocoder1255 2015北京赛区G】【简单模拟 简化写法超棒哦】 Mysterious Antiques in Sackler Museum 四个矩形选三个 恰好拼成大矩形
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) C. Little Artem and Matrix 模拟
- xtu1146 Boys and Girls 简单模拟
- Codeforces Round #199 (Div. 2) -- B. Xenia and Spies (简单模拟)
- hdu 1200 To and Fro(简单模拟或DP)
- hdu 5396 Expression ||2015 Multi-University Training Contest 9 || 简单模拟
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition)-B. Little Artem and Grasshopper(模拟)
- POJ 3106 Flip and Turn 模拟 分析
- VK Cup 2015 - Round 1 E. Rooks and Rectangles 线段树 定点修改,区间最小值
- HDU-1200-To and Fro(Java农夫山泉+简单模拟)
- 2014-2015 ACM-ICPC, Asia Tokyo Regional Contest B題:Miscalculation [简单模拟]
- hdu 5301 Buildings (2015多校第二场第2题) 简单模拟
- 模拟 poj 3106 Flip and Turn
- hdu 5301 Buildings (2015多校第二场第2题) 简单模拟
- zzulioj 1842: LT的求助again and again (简单模拟)
- HDU5444 2015长春网络赛H题(dfs遍历二叉树 简单模拟)