1 条题解

  • 1
    @ 2025-7-30 17:33:58
    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        int n,cnt=0;
        cin>>n;
        for (int i = 1; i <= n; ++i)
        {
        int x = i;   
        while (x > 0) 
        {
            if (x % 10 == 1) 
                cnt++;  
            x = x / 10; 
        }
    }
    cout<<cnt;
        return 0;
    }
    
    
    • 1

    信息

    ID
    181
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    (无)
    递交数
    15
    已通过
    10
    上传者