1 条题解

  • 0
    @ 2025-6-28 16:55:39

    月名排序

    题目怎么说,我们就怎么做。

    #include <bits/stdc++.h>
    using namespace std;
    string month[13] = {
        "",
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "August",
        "September",
        "October",
        "November",
        "December"};
    string new_month[13];
    string in_month;
    int main()
    {
        freopen("month.in", "r", stdin);
        freopen("month.out", "w", stdout);
        for (int i = 1; i <= 12; i++)
            new_month[i] = month[i];
        sort(new_month + 1, new_month + 12 + 1);
        cin >> in_month;
        for (int i = 1; i <= 12; i++)
            if (in_month == new_month[i])
                cout << month[i];
        return 0;
    }
    
    • 1

    信息

    ID
    1600
    时间
    1000ms
    内存
    512MiB
    难度
    5
    标签
    递交数
    27
    已通过
    13
    上传者