結果

問題 No.565 回転拡大
ユーザー takeya_okinotakeya_okino
提出日時 2017-09-18 23:47:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 1,389 bytes
コンパイル時間 2,416 ms
コンパイル使用メモリ 80,032 KB
実行使用メモリ 54,504 KB
最終ジャッジ日時 2024-04-25 15:35:14
合計ジャッジ時間 8,020 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
54,504 KB
testcase_01 AC 147 ms
54,468 KB
testcase_02 AC 140 ms
54,180 KB
testcase_03 AC 135 ms
54,104 KB
testcase_04 AC 143 ms
53,896 KB
testcase_05 AC 134 ms
54,492 KB
testcase_06 AC 142 ms
54,116 KB
testcase_07 AC 147 ms
54,288 KB
testcase_08 AC 145 ms
54,224 KB
testcase_09 AC 137 ms
54,224 KB
testcase_10 AC 136 ms
54,084 KB
testcase_11 AC 139 ms
54,024 KB
testcase_12 AC 141 ms
53,984 KB
testcase_13 AC 135 ms
54,080 KB
testcase_14 AC 133 ms
53,744 KB
testcase_15 AC 146 ms
54,096 KB
testcase_16 AC 143 ms
54,152 KB
testcase_17 AC 134 ms
54,392 KB
testcase_18 AC 143 ms
54,072 KB
testcase_19 AC 145 ms
54,372 KB
testcase_20 AC 138 ms
54,136 KB
testcase_21 AC 137 ms
53,872 KB
testcase_22 AC 142 ms
54,064 KB
testcase_23 AC 133 ms
54,060 KB
testcase_24 AC 140 ms
53,984 KB
testcase_25 AC 131 ms
53,164 KB
testcase_26 AC 142 ms
54,288 KB
testcase_27 AC 140 ms
54,248 KB
testcase_28 AC 138 ms
54,124 KB
testcase_29 AC 145 ms
54,128 KB
testcase_30 AC 131 ms
54,256 KB
testcase_31 AC 131 ms
54,196 KB
testcase_32 AC 128 ms
54,004 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[][] fig = new char[h][w];
    for(int i = 0; i < h; i++) {
      String s = sc.next();
      for(int j = 0; j < w; j++) {
        fig[i][j] = s.charAt(j);
      }
    }
    char[][] rot;
    int row = 0;
    int col = 0;
    if(r == 0) {
      rot = fig;
      row = k * h;
      col = k * w;
    } else if(r == 90) {
      rot = new char[w][h];
      row = k * w;
      col = k * h;
      for(int i = 0; i < w; i++) {
        for(int j = 0; j < h; j++) {
          rot[i][j] = fig[h - 1 - j][i];
        }
      }
    } else if(r == 180) {
      rot = new char[h][w];
      row = k * h;
      col = k * w;
      for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
          rot[i][j] = fig[h - 1 - i][w - 1 - j];
        }
      }
    } else {
      rot = new char[w][h];
      row = k * w;
      col = k * h;
      for(int i = 0; i < w; i++) {
        for(int j = 0; j < h; j++) {
          rot[i][j] = fig[j][w - 1 - i];
        }
      }
    }
    for(int i = 0; i < row; i++) {
      String s = "";
      for(int j = 0; j < col; j++) {
        s += String.valueOf(rot[i / k][j / k]);
      }
      System.out.println(s);
    }
  }
}
0