C#练习题答案: 速记4人生【难度:2级】--景越C#经典编程题库,1000道C#基础练习题等你来挑战

速记4人生【难度:2级】:

答案1:

namespace IBM{
  class A_24_1403_5{
    static  byte[][] MAP = new byte[][]{
      /*12*/new byte[]{ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
      /*11*/new byte[]{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
      /* 0*/new byte[]{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0},
      /* 1*/new byte[]{ 0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0},
      /* 2*/new byte[]{ 0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0},
      /* 3*/new byte[]{ 0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0},
      /* 4*/new byte[]{ 0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0},
      /* 5*/new byte[]{ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0},
      /* 6*/new byte[]{ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0},
      /* 7*/new byte[]{ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1},
      /* 8*/new byte[]{ 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},
      /* 9*/new byte[]{ 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    };
    
    private static char[] CMAP = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;¢.<(+|-!$*);¬/ ,%_>?:#@'=\"".ToCharArray();
    
    public static string read(byte[][] Card){
      string ret="";
      for (int i = 0; i < Card[0].Length; i++)
      {
        for (int ii=0; ii < MAP[0].Length; ii++)
        {
          int CF = 0;
          for (int r = 0; r < Card.Length; r++)
            if (MAP[r][ii] == Card[r][i])
              CF++;
          if (CF == Card.Length )
            ret+=CMAP[ii];
        }
      }
      return ret;
    }
  }
}

答案2:

namespace IBM{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  class A_24_1403_5 {
    private static Dictionary<int, string> m = new Dictionary<int, string>();
    public static void scan() {
      for(int c=1; c<256; c++) {
        try {
          string s = ((char)c).ToString();
          m[A_24_1403_5_GEN.generate(s).Aggregate(0,(t,r)=>t*2+r[0])]=s;
        } catch {}
      }
    }
    public static string read(byte[][] card) {
      if(m.Count==0) scan();
      return String.Join("",card[0].Select((_,i)=>m[card.Aggregate(0,(t,r)=>t*2+r[i])]));
    }
  }
}

答案3:

namespace IBM
{
  using System.Linq;
  using System.Collections.Generic;
  class A_24_1403_5
  {
    static Dictionary<string,char> U = new Dictionary<string,char>();
    static A_24_1403_5()
    {
      for (char V = '\0';V < 256;++V)
        try {U.Add(string.Join("",A_24_1403_5_GEN.generate("" + V).Select(B => B[0])),V);}
        catch (System.Exception) {}
    }
    public static string read(byte[][] Q)
    {
      string R = "";
      for (int V = 0;V < Q[0].Length;++V) R += U[string.Join("",Q.Select(B => B[V]))];
      return R;
    }
  }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值