校验输入的拼音是否符合声母韵母搭配规则(不是根据汉字生成拼音)

首发地址

搭配表

校验输入的拼音是否符合声母韵母搭配规则(不是根据汉字生成拼音)

根据搭配表暴力生成所有拼音组合

std::vector<std::string> TABLE = []()
{
    std::vector<std::string> master{"", "b", "p", "m", "f", "d", "t", "n", "l", "g", "k", "h", "j", "q", "x", "z", "c", "s", "zh", "ch", "sh", "r", "y", "w"};
    std::vector<std::string> slave{"a", "o", "e", "i", "u", "u", "ai", "ao", "an", "ang", "ou", "ong", "ei", "er", "en", "eng", "iu", "ie", "in", "ing", "ia", "iao", "ian", "iang", "iong", "ui", "un", "ua", "uai", "uan", "uang", "uo", "ue"};
    std::vector<std::string> table(33, "");
    table[0] = "111111111111000111111011";
    table[1] = "111110000000000000000011";
    table[2] = "100101111111000111111110";
    table[3] = "011101111000111111111110";
    table[4] = "011111111111000111111101";
    table[5] = "000000000000111000000010";
    table[6] = "111101111111000111111001";
    table[7] = "111101111111000111111110";
    table[8] = "111111111111000111111111";
    table[9] = "111111111111000111111111";
    table[10] = "101111111111000111111110";
    table[11] = "000001111111000111110110";
    table[12] = "111111111111000110101001";
    table[13] = "100000000000000000000000";
    table[14] = "111111010111000111111101";
    table[15] = "111111111111000111111101";
    table[16] = "000101011000111000000000";
    table[17] = "011101111000111000000000";
    table[18] = "011100011000111000000010";
    table[19] = "011101111000111000000010";
    table[20] = "000001001000111000000000";
    table[21] = "011101111000111000000000";
    table[22] = "011101111000111000000000";
    table[23] = "000000011000111000000000";
    table[24] = "000000000000111000000000";
    table[25] = "000001100111000111111100";
    table[26] = "000001111111111111111100";
    table[27] = "000000000111000000111100";
    table[28] = "000000000111000000111000";
    table[29] = "000001111111111111111110";
    table[30] = "000000000111000000111000";
    table[31] = "000001111111000111111100";
    table[32] = "000000011000111000000010";

    std::vector<std::string> rs_table;

    for (int i = 0; i < 33; ++i)
    {
        for (int j = 0; j < 24; ++j)
        {
            if (table[i][j] == '1')
            {
                rs_table.emplace_back(master[j] + slave[i]);
            }
        }
    }
    return rs_table;
}();

检查拼音是否存在

上一篇:yLOI2018 扶苏的问题


下一篇:java的数据类型操作 - String