NC24292. [USACO 2016 Dec B]The Cow-Signal
描述
输入描述
The first line of input contains M, N, and K, separated by spaces.
The next M lines each contain a length-N string, collectively describing the picture of the signal.
输出描述
You should output KM lines, each with KN characters, giving a picture of the enlarged signal.
示例1
输入:
5 4 2 XXX. X..X XXX. X..X XXX.
输出:
XXXXXX.. XXXXXX.. XX....XX XX....XX XXXXXX.. XXXXXX.. XX....XX XX....XX XXXXXX.. XXXXXX..
Pascal(fpc 3.0.2) 解法, 执行用时: 2ms, 内存消耗: 256K, 提交时间: 2020-08-05 17:58:07
type str=string; var m,n,p,i,j,a,b:longint; s:str; begin readln(m,n,p); for i:=1 to m do begin readln(s); for a:=1 to p do begin for j:=1 to length(s) do begin for b:=1 to p do write(s[j]); end; writeln; end; end; end.
C++11(clang++ 3.9) 解法, 执行用时: 3ms, 内存消耗: 504K, 提交时间: 2020-08-06 09:18:30
#include<stdio.h> char s[15][15]; int main(){ int n,m,k; scanf("%d %d %d",&n,&m,&k); for(int i=0;i<n;i++)scanf("%s",s[i]); for(int i=0;i<n;i++){ for(int sb=0;sb<k;sb++){ for(int j=0;j<m;j++){ for(int p=0;p<k;p++){ printf("%c",s[i][j]); }}printf("\n");}} }
Python3(3.5.2) 解法, 执行用时: 17ms, 内存消耗: 3448K, 提交时间: 2020-08-06 10:14:09
a=input().split(' ') for b in range(int(a[0])): c=input() e="" for d in range(int(a[1])): e=e+c[d]*int(a[2]) for f in range(int(a[2])): print(e)