結果

問題 No.565 回転拡大
ユーザー htensaihtensai
提出日時 2019-11-14 20:33:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 1,267 bytes
コンパイル時間 3,180 ms
コンパイル使用メモリ 77,044 KB
実行使用メモリ 57,696 KB
最終ジャッジ日時 2023-10-21 22:30:29
合計ジャッジ時間 8,741 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
57,176 KB
testcase_01 AC 113 ms
56,192 KB
testcase_02 AC 123 ms
57,132 KB
testcase_03 AC 124 ms
57,296 KB
testcase_04 AC 126 ms
57,484 KB
testcase_05 AC 126 ms
57,328 KB
testcase_06 AC 122 ms
57,492 KB
testcase_07 AC 132 ms
57,544 KB
testcase_08 AC 130 ms
57,352 KB
testcase_09 AC 124 ms
57,396 KB
testcase_10 AC 110 ms
56,104 KB
testcase_11 AC 125 ms
57,108 KB
testcase_12 AC 120 ms
57,444 KB
testcase_13 AC 121 ms
57,376 KB
testcase_14 AC 109 ms
56,104 KB
testcase_15 AC 126 ms
57,116 KB
testcase_16 AC 125 ms
57,120 KB
testcase_17 AC 127 ms
57,696 KB
testcase_18 AC 133 ms
57,400 KB
testcase_19 AC 132 ms
57,656 KB
testcase_20 AC 126 ms
57,384 KB
testcase_21 AC 126 ms
57,152 KB
testcase_22 AC 130 ms
57,464 KB
testcase_23 AC 125 ms
57,360 KB
testcase_24 AC 130 ms
57,340 KB
testcase_25 AC 132 ms
57,340 KB
testcase_26 AC 131 ms
57,268 KB
testcase_27 AC 128 ms
57,356 KB
testcase_28 AC 127 ms
57,368 KB
testcase_29 AC 125 ms
57,184 KB
testcase_30 AC 126 ms
57,368 KB
testcase_31 AC 124 ms
57,412 KB
testcase_32 AC 124 ms
57,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int k = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] org = new char[h][];
		for (int i = 0; i < h; i++) {
		    org[i] = sc.next().toCharArray();
		}
		char[][] next;
		if (r == 0) {
		    next = org;
		} else {
		    if (r == 180) {
		        next = new char[h][w];
		    } else {
		        next = new char[w][h];
		    }
		    for (int i = 0; i < h; i++) {
		        for (int j = 0; j < w; j++) {
		            if (r == 90) {
		                next[j][h - i - 1] = org[i][j];
		            } else if (r == 180) {
		                next[h - i - 1][w - j -1] = org[i][j];
		            } else {
		                next[w - j - 1][i] = org[i][j];
		            }
		        }
		    }
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < next.length; i++) {
		    StringBuilder tmp = new StringBuilder();
		    for (int j = 0; j < next[i].length; j++) {
		        for (int a = 0; a < k; a++) {
		            tmp.append(next[i][j]);
		        }
		    }
		    tmp.append("\n");
		    for (int a = 0; a < k; a++) {
		        sb.append(tmp);
		    }
		}
		System.out.print(sb);
	}
}
0