2 条题解

  • 0

    #include <iostream>
    using namespace std;
    int main()
    {
    int a,b,k;
    cin>>a>>b>>k;
    int cnt=0;
    for(int x=a;x<=b;x++)
    {
    int xx=x;
    while(xx>0)
    {
    if(xx%10==k)
    cnt++;
    xx=xx/10;
    }
    }
    cout<<cnt<<endl;
    return 0;
    }

  • -2
    @ 2021-02-13 16:42:31
    #include <iostream>
    using namespace std;
    int main()
    {
        int a,b,k;
        cin>>a>>b>>k;
        int cnt=0;
        for(int x=a;x<=b;x++)
        {
            int xx=x;
            while(xx>0)
            {
                if(xx%10==k)
                    cnt++;
                xx=xx/10;
            }
        }
        cout<<cnt<<endl;
        return 0;
    }
    
  • 1

信息

ID
1211
难度
2
分类
(无)
标签
递交数
102
已通过
61
通过率
60%
被复制
10
上传者