Codingame『ASCII Art』

f:id:pongeponge:20150114071536j:plain
(´・ω・`) < MANHATTAN


 指定された文字列をアスキーアートで表現する問題。
文字列の抽出ができるなら、できると思う。

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

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
class Solution
{
    static void Main(string[] args)
    {
        int L = int.Parse(Console.ReadLine()); //ASCII Art 1文字の幅
        int H = int.Parse(Console.ReadLine()); //ASCII Art 1文字の高さ
        string T = Console.ReadLine();         //ASCII Artに変換する文字列
        string answer = "";                    //ASCII Artに変換した文字列

        for (int i = 0; i < H; i++)
        {
            string ROW = Console.ReadLine(); //ASCII Art一列分を読み込む
            
            for(int j = 0; j < T.Length; j++) {
                int num = CharToNumber(T[j]);      //文字が何番目か番号を取得
                answer += ROW.Substring(num*L, L); //文字を抽出して加えていく
            }
            answer += Environment.NewLine; //改行
        }

        // Write an action using Console.WriteLine()
        // To debug: Console.Error.WriteLine("Debug messages...");
        Console.Error.WriteLine("debug:param"); //デバッグ用
        Console.Error.WriteLine("L:"+L);
        Console.Error.WriteLine("H:"+H);
        Console.Error.WriteLine("T:"+T);
        Console.Error.WriteLine("");

        Console.WriteLine(answer);
    }
    
    //何番目の文字か取得する
    //引数 char c : 番号を取得する文字
    //戻り値 int : 文字の番号
    public static int CharToNumber(char c)
    {
        if(c >= 'a' && c <= 'z') { //小文字の処理
            return c - 'a';
        }
        else if(c >= 'A' && c <= 'Z') { //大文字の処理
            return c - 'A';
        }
        else { //その他の場合は?を表示させる
            return 'Z' - 'A' + 1;
        }
    }
}


(´・ω・`) < テスト項目のMANHATTAN押しが強すぎる