1670. 珅泽教育CSP-J第一轮模拟考第六套 第 19 题

珅泽教育CSP-J第一轮模拟考第六套 第 19 题

二、阅读程序·第1题(选择题)

int solve1(int n)
{
    int s = 0;
    for (int i = 1; i <= n; ++i) {
        int f = 1;
        for (int j = i; j >= 1; --j) {
            f = f * i;
        }
        s = s + f;
    }
    return s;
}

int solve2(int n)
{
    int s = 0;
    for (int i = n; i >= 1; --i)
    {
        s = s + 1;
        s = s * i;
    }
    return s;
}

保证 solve1 与 solve2 的参数 n 是正整数。

两个函数都有唯一的从大循环到小的 for 语句,如果将这两条语句的循环次序颠倒,则返回值( )。

{{ select(1) }}

  • solve1 不变,solve2 变大
  • solve1 不变,solve2 变小
  • solve1 变小,solve2 变小
  • solve1 变大,solve2 变小