总的来说还是很简单的。
先用Enum枚举出26个字母和"?"
然后根据输入的H和L,把每个字母的ASCII ART样式保存在一个string数组里
string[字母序号,H]
然后识别输入的字符串,每个进行判断,把每个字母的逐行放入string b里再加入\n换行,最后一起输出
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
{
enum words {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,none};
static void Main(string[] args)
{
int L = int.Parse(Console.ReadLine());
int H = int.Parse(Console.ReadLine());
string T = Console.ReadLine().ToUpper();
int l =0;
int w =0;
string[,] word = new string[27,H];
string b="";
for (int i = 0; i < H; i++)
{
string ROW = Console.ReadLine();
for (int j=0;j<27;j++){
l=j*L;
word[j,i]= ROW.Substring(l,L);
}
}
for(int i =0;i<H;i++)
{
foreach(char a in T){
string c =a.ToString();
if(Enum.IsDefined(typeof(words),c)){
w =(int)(words)Enum.Parse(typeof(words),c);}
else{w = 26;}
b =b + word[w,i];
}
b= b+"\n";
}
Console.WriteLine(b);
// Write an answer using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
}
}
这里有个(int)(words)Enum.Parse(typeof(words),c)
其实是(int)(枚举名字)Enum.Parse(typeof(枚举名字),想要判断的变量)
就会输出一个“c”那个变量字符串的在枚举中的value