3 条题解

  • 1
    @ 2025-1-8 11:32:23
    #include <iostream>
    #include <algorithm>
    #include <string>
    using namespace std;
    
    int main()
    {
        int n;
        cin >> n;
        string a;
        while (n--)
        {
            cin >> a;
            sort(a.begin(), a.end());
            for (int i = 0; i < a.size(); i++)
            {
                cout << a[i]<<" ";
            }
            cout << endl;
        }
        return 0;
    }
    }strlen测量的是字符串常量,而cin就表明这个字符串不是常量是变量,所以我们用size()去测量长度,用的是c++里面的string类型定义字符串
    
    • @ 2025-6-28 9:03:10

      字符串的大小是固定的,3,不用size()

信息

ID
120
时间
3000ms
内存
128MiB
难度
7
标签
递交数
2316
已通过
530
上传者