#1288. [CSP2024 入门级] 第 29 题

[CSP2024 入门级] 第 29 题

#include <iostream>
#include <cmath>
using namespace std;

int customFunction(int a, int b) {
    if (b == 0) return a;
    return a + customFunction(a, b-1);
}

int main() {
    int x, y;
    cin >> x >> y;
    int result = customFunction(x, y);
    cout << pow(result, 2) << endl;
}

b 的值越大,程序的运行时间越长。( )

{{ select(1) }}

  • 正确
  • 错误