3 solutions

  • 0
    @ 2024-4-8 10:52:12
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    int n=0;
    for(int i=1;i<2021;i++)
    {
    int b;
    b=i;
    while(b)
    {
    if(b%10==2)
    {
    n++;
    }
    b=b/10;
    }
    }
    cout<<n<<endl;
    return 0;
    }
    

    Information

    ID
    986
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    168
    Accepted
    61
    Uploaded By