結果

問題 No.565 回転拡大
ユーザー fmhrfmhr
提出日時 2017-09-08 23:46:13
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,306 bytes
コンパイル時間 14,728 ms
コンパイル使用メモリ 235,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 02:42:44
合計ジャッジ時間 15,805 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
5,248 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 4 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 4 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 5 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 3 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"log"
)

func main() {
	var R, K, H, W int
	fmt.Scan(&R, &K, &H, &W)
	HW := max(H, W)

	c := make([][]byte, HW)
	for i := 0; i < HW; i++ {
		c[i] = make([]byte, HW)
	}
	var s string
	for i := 0; i < H; i++ {
		fmt.Scan(&s)
		for j := 0; j < W; j++ {
			c[i][j] = s[j]
		}
	}
	d := make([][]byte, HW)
	for i := 0; i < HW; i++ {
		d[i] = make([]byte, HW)
		for j := 0; j < HW; j++ {
			d[i][j] = 'x'
		}
	}

	switch R {
	case 0:
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				d[i][j] = c[i][j]
			}
		}
	case 90:
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				d[j][i] = c[i][j]
			}
		}
	case 180:
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				d[H-1-i][j] = c[i][j]
			}
		}
	case 270:
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				d[j][H-i-1] = c[i][j]
			}
		}
	}

	for i := 0; i < HW; i++ {
		if d[i][0] == 'x' || d[i][0] == 0 {
			break
		} else {
			log.Println(d[i][0])
		}
		for t := 0; t < K; t++ {
			for j := 0; j < HW; j++ {
				if d[i][j] == 'x' || d[i][j] == 0 {
					continue
				}
				for t2 := 0; t2 < K; t2++ {
					fmt.Print(string(d[i][j]))
				}
			}
			fmt.Print("\n")
		}
	}
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
0