結果

問題 No.565 回転拡大
ユーザー YamaKasaYamaKasa
提出日時 2018-09-24 22:26:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 1,424 bytes
コンパイル時間 3,281 ms
コンパイル使用メモリ 77,332 KB
実行使用メモリ 57,764 KB
最終ジャッジ日時 2023-10-24 22:18:56
合計ジャッジ時間 8,980 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
57,712 KB
testcase_01 AC 138 ms
55,596 KB
testcase_02 AC 141 ms
57,612 KB
testcase_03 AC 132 ms
57,500 KB
testcase_04 AC 138 ms
57,684 KB
testcase_05 AC 132 ms
57,556 KB
testcase_06 AC 136 ms
57,204 KB
testcase_07 AC 140 ms
57,500 KB
testcase_08 AC 138 ms
57,532 KB
testcase_09 AC 136 ms
57,504 KB
testcase_10 AC 134 ms
57,616 KB
testcase_11 AC 135 ms
57,508 KB
testcase_12 AC 138 ms
57,640 KB
testcase_13 AC 136 ms
57,352 KB
testcase_14 AC 134 ms
57,600 KB
testcase_15 AC 138 ms
57,464 KB
testcase_16 AC 134 ms
57,732 KB
testcase_17 AC 136 ms
57,692 KB
testcase_18 AC 134 ms
57,600 KB
testcase_19 AC 143 ms
57,532 KB
testcase_20 AC 134 ms
57,492 KB
testcase_21 AC 132 ms
57,468 KB
testcase_22 AC 135 ms
57,524 KB
testcase_23 AC 132 ms
57,644 KB
testcase_24 AC 139 ms
57,764 KB
testcase_25 AC 139 ms
57,720 KB
testcase_26 AC 137 ms
57,488 KB
testcase_27 AC 137 ms
57,532 KB
testcase_28 AC 134 ms
57,600 KB
testcase_29 AC 141 ms
57,676 KB
testcase_30 AC 134 ms
57,504 KB
testcase_31 AC 138 ms
57,496 KB
testcase_32 AC 133 ms
57,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int R = scan.nextInt();
		int K = scan.nextInt();
		int H = scan.nextInt();
		int W = scan.nextInt();
		int[][]c = new int[H][W];
		for(int i = 0; i < H; i++) {
			String s = scan.next();
			for(int j = 0; j < W; j++) {
				if(s.charAt(j) == '#') {
					c[i][j] = 1;
				}
			}
		}
		scan.close();
		if(R == 0) {
			disp(c, H, W, K);
		}else if(R == 180) {
			int[][] new_c = new int[H][W];
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					new_c[i][j] = c[H - i - 1][W - j - 1];
				}
			}
			disp(new_c, H, W, K);
		}else if(R == 90) {
			int[][] new_c = new int[W][H];
			for(int i = 0; i < W; i++) {
				for(int j = 0; j < H; j++) {
					new_c[i][j] = c[H - j - 1][i];
				}
			}
			disp(new_c, W, H, K);
		}else {
			int[][] new_c = new int[W][H];
			for(int i = 0; i < W; i++) {
				for(int j = 0; j < H; j++) {
					new_c[i][j] = c[j][W - i - 1];
				}
			}
			disp(new_c, W, H, K);
		}
	}
	static void disp(int[][] cell, int r, int c, int t) {
		for(int i = 0; i < r; i++) {
			StringBuilder sb = new StringBuilder();
			for(int j = 0; j < c; j++) {
				char ch = '.';
				if(cell[i][j] == 1) {
					ch = '#';
				}
				for(int k = 0; k < t; k++) {
					sb.append(ch);
				}
			}
			for(int k = 0; k < t; k++) {
				System.out.println(sb.toString());
			}
		}
	}
}
0