結果

問題 No.565 回転拡大
ユーザー バカらっくバカらっく
提出日時 2017-09-08 22:46:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 2,598 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 106,360 KB
実行使用メモリ 23,940 KB
最終ジャッジ日時 2023-08-07 03:06:53
合計ジャッジ時間 5,564 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,856 KB
testcase_01 AC 60 ms
23,844 KB
testcase_02 AC 60 ms
21,868 KB
testcase_03 AC 61 ms
23,892 KB
testcase_04 AC 62 ms
21,868 KB
testcase_05 AC 61 ms
21,956 KB
testcase_06 AC 62 ms
23,868 KB
testcase_07 AC 62 ms
19,884 KB
testcase_08 AC 63 ms
23,940 KB
testcase_09 AC 64 ms
23,912 KB
testcase_10 AC 61 ms
21,752 KB
testcase_11 AC 62 ms
21,900 KB
testcase_12 AC 61 ms
21,840 KB
testcase_13 AC 62 ms
19,812 KB
testcase_14 AC 63 ms
21,912 KB
testcase_15 AC 62 ms
21,988 KB
testcase_16 AC 62 ms
23,856 KB
testcase_17 AC 62 ms
21,952 KB
testcase_18 AC 61 ms
21,812 KB
testcase_19 AC 61 ms
21,844 KB
testcase_20 AC 61 ms
21,940 KB
testcase_21 AC 61 ms
23,904 KB
testcase_22 AC 60 ms
21,856 KB
testcase_23 AC 61 ms
21,880 KB
testcase_24 AC 61 ms
21,872 KB
testcase_25 AC 62 ms
23,924 KB
testcase_26 AC 62 ms
21,740 KB
testcase_27 AC 61 ms
21,904 KB
testcase_28 AC 61 ms
21,800 KB
testcase_29 AC 62 ms
21,888 KB
testcase_30 AC 62 ms
21,884 KB
testcase_31 AC 61 ms
23,784 KB
testcase_32 AC 61 ms
21,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int kakudo = inpt[0];
        int zoom = inpt[1];

		inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int tate = inpt[0];
        int yoko = inpt[1];

        char[][] map = new char[tate][];
        for (int i = 0; i < tate; i++) {
            map[i] = Reader.ReadLine().ToArray();
        }

        for (int i = kakudo; i > 0; i-=90) {
            map = Rotate(map);
        }

        tate = map.Length;
        yoko = map[0].Length;
		char[][] newMap = new char[tate * zoom][];
		for (int i = 0; i < tate; i++) {
            for (int j = 0; j < yoko; j++) {
                for (int k = 0; k < zoom; k++) {
                    int row = i * zoom + k;
                    if(newMap[row] == null) {
                        newMap[row] = new char[yoko * zoom];
                    }
                    for (int l = 0; l < zoom; l++) {
                        int col = j * zoom + l;
                        newMap[row][col] = map[i][j];
                    }
                }
            }
        }

        Console.WriteLine(Print(newMap));

	}


    private string Print(char[][] src) {
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < src.Length; i++) {
            for (int j = 0; j < src[i].Length; j++) {
                ans.Append(src[i][j]);
            }
            ans.AppendLine(string.Empty);
        }
        return ans.ToString().Trim();
    }

    private char[][] Rotate(char[][] src) {
        int tate = src[0].Length;
        int yoko = src.Length;

        char[][] ret = new char[tate][];
        for (int i = 0; i < tate; i++) {
            ret[i] = new char[yoko];
            for (int j = 0; j < yoko; j++) {
                ret[i][j] = src[yoko -1- j][i];
            }
        }
        return ret;
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


90 1
5 6
.#....
.#....
.#####
.#....
.#....



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}
0