結果
| 問題 |
No.565 回転拡大
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2017-09-08 22:46:54 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 2,598 bytes |
| コンパイル時間 | 996 ms |
| コンパイル使用メモリ | 109,440 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-11-07 06:31:40 |
| 合計ジャッジ時間 | 3,028 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
}
}
バカらっく