parent
83c935bfd0
commit
32147d8eb0
@ -0,0 +1,23 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int func(int x) {
|
||||||
|
if (x <= 3)
|
||||||
|
return x * 2 - 1;
|
||||||
|
else if (x >= 6)
|
||||||
|
return func(x - 3) - 2;
|
||||||
|
else
|
||||||
|
return func(x + 1) + x;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cout << func(14);
|
||||||
|
// f(14)=f(11)-2;
|
||||||
|
// f(11)=f(8)-2
|
||||||
|
// f(8)=f(5)-2
|
||||||
|
// f(5)=f(6)+5
|
||||||
|
// f(6)=f(3)-2
|
||||||
|
// f(3)=5
|
||||||
|
return 0;
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
https://ccgao.blog.csdn.net/article/details/134725679
|
@ -0,0 +1,5 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
using namespace std;
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in new issue