#1289. [CSP2024 入门级] 第 30 题

[CSP2024 入门级] 第 30 题

第 3 题

#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;
    return 0;
}

判断题

当输入为 5 4 时,customFunction(5, 4) 的返回值为( )。

{{ select(1) }}

  • 99
  • 1616
  • 2525
  • 3636