結果

問題 No.565 回転拡大
ユーザー GrenacheGrenache
提出日時 2017-09-08 22:37:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 1,945 bytes
コンパイル時間 3,923 ms
コンパイル使用メモリ 77,888 KB
実行使用メモリ 41,676 KB
最終ジャッジ日時 2024-04-24 21:17:52
合計ジャッジ時間 9,786 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
40,652 KB
testcase_01 AC 137 ms
41,676 KB
testcase_02 AC 135 ms
39,980 KB
testcase_03 AC 135 ms
41,248 KB
testcase_04 AC 142 ms
41,412 KB
testcase_05 AC 133 ms
41,208 KB
testcase_06 AC 140 ms
41,152 KB
testcase_07 AC 135 ms
41,124 KB
testcase_08 AC 135 ms
39,824 KB
testcase_09 AC 131 ms
41,108 KB
testcase_10 AC 133 ms
41,560 KB
testcase_11 AC 127 ms
40,232 KB
testcase_12 AC 141 ms
40,932 KB
testcase_13 AC 134 ms
41,356 KB
testcase_14 AC 124 ms
40,272 KB
testcase_15 AC 139 ms
41,228 KB
testcase_16 AC 125 ms
40,132 KB
testcase_17 AC 123 ms
39,992 KB
testcase_18 AC 125 ms
40,316 KB
testcase_19 AC 143 ms
41,544 KB
testcase_20 AC 121 ms
40,224 KB
testcase_21 AC 137 ms
41,288 KB
testcase_22 AC 128 ms
40,104 KB
testcase_23 AC 135 ms
41,104 KB
testcase_24 AC 142 ms
41,144 KB
testcase_25 AC 144 ms
41,456 KB
testcase_26 AC 137 ms
40,900 KB
testcase_27 AC 139 ms
41,316 KB
testcase_28 AC 140 ms
41,464 KB
testcase_29 AC 137 ms
41,248 KB
testcase_30 AC 136 ms
41,304 KB
testcase_31 AC 131 ms
40,900 KB
testcase_32 AC 140 ms
41,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder565 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int r = sc.nextInt();
		int k = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		char[][] c = new char[h][];
		for (int i = 0; i < h; i++) {
			c[i] = sc.next().toCharArray();
		}

		char[][] ret = null;
		if (r == 0) {
			ret = new char[h * k][w * k];
			for (int i = 0; i < h; i++) {
				for (int ik = 0; ik < k; ik++) {
					for (int j = 0; j < w; j++) {
						for (int jk = 0; jk < k; jk++) {
							ret[i * k + ik][j * k + jk] = c[i][j];
						}
					}
				}
			}
		} else if (r == 180) {
			ret = new char[h * k][w * k];
			for (int i = 0; i < h; i++) {
				for (int ik = 0; ik < k; ik++) {
					for (int j = 0; j < w; j++) {
						for (int jk = 0; jk < k; jk++) {
							ret[i * k + ik][j * k + jk] = c[h - 1 - i][w - 1 - j];
						}
					}
				}
			}
		} else if (r == 90) {
			ret = new char[w * k][h * k];
			for (int j = 0; j < w; j++) {
				for (int jk = 0; jk < k; jk++) {
					for (int i = 0; i < h; i++) {
						for (int ik = 0; ik < k; ik++) {
							ret[j * k + jk][i * k + ik] = c[h - 1 - i][j];
						}
					}
				}
			}
		} else {
			ret = new char[w * k][h * k];
			for (int j = 0; j < w; j++) {
				for (int jk = 0; jk < k; jk++) {
					for (int i = 0; i < h; i++) {
						for (int ik = 0; ik < k; ik++) {
							ret[j * k + jk][i * k + ik] = c[i][w - 1 - j];
						}
					}
				}
			}
		}

		for (int i = 0; i < ret.length; i++) {
			for (int j = 0; j < ret[0].length; j++) {
				pr.print(ret[i][j]);
			}
			pr.println();
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0