全部评论 2

  • 全程复制粘贴。。。

    2025-08-20 来自 浙江

    1
  • 用switch也可以……

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n, record[4][13] = {}, cnt = 0;
        cin >> n;
        for(int i = 0; i < n; i++)
            {
                char num, flower;
                int num_t, flower_t;
                cin >> flower >> num;
                num_t = num - 49;
                switch(num)
                    {
                        case 'A':num_t = 0;break;
                        case 'T':num_t = 9;break;
                        case 'J':num_t = 10;break;
                        case 'Q':num_t = 11;break;
                        case 'K':num_t = 12;break;
                    }
                switch(flower)
                    {
                        case 'D':flower_t = 0;break;
                        case 'C':flower_t = 1;break;
                        case 'H':flower_t = 2;break;
                        case 'S':flower_t = 3;break;
                    }
                record[flower_t][num_t] = 1;
            }
        for(int i = 0; i < 4; i++)
            {
                for(int j = 0; j < 13; j++)
                    {
                        if(record[i][j] != 1)
                            cnt++;
                    }
            }
        cout << cnt;
        return 0;
    }
    

    2025-08-22 来自 浙江

    0
    • 确实可以哈,主要是是考试的时候做的,没往深了想

      6天前 来自 浙江

      0
暂无数据

提交答案之后,这里将显示提交结果~

首页