結果

問題 No.565 回転拡大
ユーザー takeya_okinotakeya_okino
提出日時 2017-09-18 23:44:26
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,389 bytes
コンパイル時間 2,010 ms
コンパイル使用メモリ 79,920 KB
実行使用メモリ 56,420 KB
最終ジャッジ日時 2024-04-25 15:34:58
合計ジャッジ時間 6,999 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 126 ms
54,308 KB
testcase_04 RE -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 124 ms
54,200 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 124 ms
54,348 KB
testcase_17 AC 124 ms
54,144 KB
testcase_18 AC 114 ms
53,020 KB
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 AC 126 ms
54,240 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 / 3][j / 3]);
      }
      System.out.println(s);
    }
  }
}
0