結果
問題 |
No.565 回転拡大
|
ユーザー |
![]() |
提出日時 | 2019-11-14 20:33:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 1,267 bytes |
コンパイル時間 | 2,636 ms |
コンパイル使用メモリ | 77,084 KB |
実行使用メモリ | 41,364 KB |
最終ジャッジ日時 | 2024-09-21 23:59:38 |
合計ジャッジ時間 | 7,635 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
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[][] org = new char[h][]; for (int i = 0; i < h; i++) { org[i] = sc.next().toCharArray(); } char[][] next; if (r == 0) { next = org; } else { if (r == 180) { next = new char[h][w]; } else { next = new char[w][h]; } for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (r == 90) { next[j][h - i - 1] = org[i][j]; } else if (r == 180) { next[h - i - 1][w - j -1] = org[i][j]; } else { next[w - j - 1][i] = org[i][j]; } } } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < next.length; i++) { StringBuilder tmp = new StringBuilder(); for (int j = 0; j < next[i].length; j++) { for (int a = 0; a < k; a++) { tmp.append(next[i][j]); } } tmp.append("\n"); for (int a = 0; a < k; a++) { sb.append(tmp); } } System.out.print(sb); } }