CSP-J 2024 入门级 第一轮(初赛) 阅读程序(3)

剩余时间:15:00
1 #include < iostream >
2 #include < cmath >
3 using namespace std;
4
5 int customFunction(int a, int b) {
6     if (b == 0) {
7         return a;
8     }
9     return a + customFunction(a , b - 1);
10 }
11
12 int main() {
13     int x, y;
14     cin >> x >> y;
15     int result = customFunction(x, y);
16     cout << pow(result, 2) << endl;
17     return 0;
18 }

0%