結果

問題 No.565 回転拡大
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-27 12:53:45
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,086 bytes
コンパイル時間 12,462 ms
コンパイル使用メモリ 228,820 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-19 09:51:13
合計ジャッジ時間 11,967 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import "fmt"

func main() {
	var r, k, h, w, x, y int
	_, _ = fmt.Scan(&r, &k, &h, &w)

	index := func(i, j int) int { return 0 }
	switch r {
	case 0:
		x, y = h, w
		index = func(i, j int) int { return y*i + j }
	case 90:
		x, y = w, h
		index = func(i, j int) int { return y - 1 - i + (x-1)*j }
	case 180:
		x, y = h, w
		index = func(i, j int) int { return x*y - y*i - j - 1 }
	case 270:
		x, y = w, h
		index = func(i, j int) int { return y*(x-1) + i - y*j }
	}

	// 回転しながら配列に入れる
	pic := make([]int, h*w)
	var c string
	for i := 0; i < h; i++ {
		_, _ = fmt.Scan(&c)
		for j, c := range []rune(c) {
			if c == '#' {
				k := index(i, j)
				fmt.Println(i, j, k)
				pic[k] = 1
			}
		}
	}
	// fmt.Println(pic)

	// 拡大しながら出力
	for i := 0; i < x; i++ {
		for a := 0; a < k; a++ { // 拡大分の縦の繰り返し
			for j := 0; j < y; j++ {
				for a := 0; a < k; a++ { // 拡大分の横の繰り返し
					if pic[y*i+j] == 0 {
						fmt.Print(".")
					} else {
						fmt.Print("#")
					}
				}
			}
			fmt.Println()
		}
	}
}
0