2 solutions

  • 0
    @ 2023-10-6 15:20:04

    这道题也不是特别的难

    #include <bits/stdc++.h>
    using namespace std;
    int main(void)
    {
    int count = 0;
    for (int x = 1; x <= 2021; ++x)
    { // x从1到2021
    for (int y = 1; y <= 2021; ++y)
    { //y从1到2021
    if (x * y <= 2021)
    {
    count++; // 如果 x * y 不超过 2021,则满足条件,增加计数
    }
    }
    }
    cout <<count << endl;
    return 0;
    }
    

    Information

    ID
    105
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    4
    Tags
    # Submissions
    698
    Accepted
    296
    Uploaded By