2 条题解

  • 0
    @ 2026-8-22 10:42:31

    #include using namespace std;

    int main() { int m, n; cin >> m >> n; int x = 0, y = 0; int cnt = 1; //一开始就在第1个格子

    while (x < m-1 && y < n-1)
    {
        double dy = 1.0 * y * m / n;
        double dx = 1.0 * x * n / m;
        if (dy < x)
        {
            y = y + 1;
        }
        else
        {
            x = x + 1;
        }
        cnt = cnt + 1;
    }
    cout << cnt << endl;
    return 0;
    

    }

    信息

    ID
    4506
    时间
    1000ms
    内存
    512MiB
    难度
    5
    标签
    (无)
    递交数
    103
    已通过
    43
    上传者