1 条题解

  • 5
    @ 2026-5-30 21:40:35

    新手可用:

    #include <bits/stdc++.h>
    using namespace std;
    int main() {
    int x;
        cin >> x;
        int cnt = 0;
        if (x == 0)
            cnt = 1;
        else
        {
            while (x != 0)
            {
                x /= 10;
                cnt++;
            }
        }
        cout << cnt << endl;
        return 0;
    }
    
    

    老手用字符串:

    #include <iostream>
    #include <string>
    using namespace std;
    
    int main()
    {
        string s;
        cin >> s;
        cout << s.size() << endl;
        return 0;
    }
    
    
    • 1

    信息

    ID
    30917
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    (无)
    递交数
    46
    已通过
    24
    上传者