結果

問題 No.565 回転拡大
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-17 20:20:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 1,231 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 74,332 KB
実行使用メモリ 56,600 KB
最終ジャッジ日時 2023-09-06 17:53:43
合計ジャッジ時間 7,886 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 206 ms
56,600 KB
testcase_01 AC 157 ms
55,796 KB
testcase_02 AC 147 ms
56,312 KB
testcase_03 AC 107 ms
55,592 KB
testcase_04 AC 141 ms
56,084 KB
testcase_05 AC 105 ms
55,556 KB
testcase_06 AC 146 ms
55,612 KB
testcase_07 AC 145 ms
56,068 KB
testcase_08 AC 161 ms
55,976 KB
testcase_09 AC 112 ms
56,048 KB
testcase_10 AC 109 ms
55,936 KB
testcase_11 AC 123 ms
55,764 KB
testcase_12 AC 145 ms
56,040 KB
testcase_13 AC 108 ms
55,900 KB
testcase_14 AC 108 ms
55,956 KB
testcase_15 AC 146 ms
55,828 KB
testcase_16 AC 122 ms
55,520 KB
testcase_17 AC 105 ms
55,684 KB
testcase_18 AC 134 ms
55,828 KB
testcase_19 AC 151 ms
56,104 KB
testcase_20 AC 110 ms
55,992 KB
testcase_21 AC 118 ms
55,540 KB
testcase_22 AC 147 ms
55,696 KB
testcase_23 AC 104 ms
55,600 KB
testcase_24 AC 161 ms
55,900 KB
testcase_25 AC 146 ms
56,132 KB
testcase_26 AC 117 ms
56,052 KB
testcase_27 AC 156 ms
56,136 KB
testcase_28 AC 151 ms
55,708 KB
testcase_29 AC 131 ms
55,800 KB
testcase_30 AC 101 ms
55,872 KB
testcase_31 AC 108 ms
55,604 KB
testcase_32 AC 108 ms
55,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		//拡大前の画像ar1を作る
		int r = sc.nextInt();
		int k = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] ar1 = new char[h][w];
		for (int i=0; i<h; i++) {
				ar1[i] = sc.next().toCharArray();
		}
		
		//拡大後の画像ar2を作る
		int H = h*k;
		int W = w*k;
		char[][] ar2 = new char[H][W];
		for (int i=0; i<H; i++) {
			for (int j=0; j<W; j++) {
				ar2[i][j] = ar1[i/k][j/k];
			}
		}

		//ar2を指定分回転させて表示
		if (r==0) {
			for (int i=0; i<H; i++) {
				for (int j=0; j<W; j++) {
					System.out.print(ar2[i][j]);
				}
				System.out.println();
			}
		}
		else if (r==90) {
			for (int j=0; j<W; j++) {
				for (int i=H-1; i>=0; i--) {
					System.out.print(ar2[i][j]);
				}
				System.out.println();
			}
		}
		else if (r==180) {
			for (int i=H-1; i>=0; i--) {
				for (int j=W-1; j>=0; j--) {
					System.out.print(ar2[i][j]);
				}
				System.out.println();
			}
		}
		else if (r==270) {
			for (int j=W-1; j>=0; j--) {
				for (int i=0; i<H; i++) {
					System.out.print(ar2[i][j]);
				}
				System.out.println();
			}
		}
	}
}
0