結果

問題 No.565 回転拡大
ユーザー YamaKasaYamaKasa
提出日時 2018-09-24 22:09:53
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,412 bytes
コンパイル時間 2,652 ms
コンパイル使用メモリ 77,312 KB
実行使用メモリ 57,756 KB
最終ジャッジ日時 2023-10-24 17:30:06
合計ジャッジ時間 8,528 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 136 ms
57,472 KB
testcase_02 WA -
testcase_03 AC 129 ms
57,460 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 133 ms
57,756 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 136 ms
57,468 KB
testcase_13 WA -
testcase_14 AC 129 ms
57,612 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 128 ms
57,504 KB
testcase_24 WA -
testcase_25 AC 137 ms
57,504 KB
testcase_26 WA -
testcase_27 AC 136 ms
57,532 KB
testcase_28 WA -
testcase_29 AC 134 ms
57,492 KB
testcase_30 AC 118 ms
56,224 KB
testcase_31 AC 119 ms
56,180 KB
testcase_32 AC 131 ms
57,516 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 = H - 1; i >= 0; i--) {
				for(int j = W - 1; j >= 0; j--) {
					new_c[i][j] = c[i][j];
				}
			}
			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[j][i];
				}
			}
			disp(new_c, W, H, K);
		}else {
			int[][] new_c = new int[W][H];
			for(int i = W - 1; i >= 0; i--) {
				for(int j = H - 1; j >= 0; j--) {
					new_c[i][j] = c[j][i];
				}
			}
			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