问一下,大佬们怎么求出递归上界的……

P1149 [NOIP2008 提高组] 火柴棒等式

```cpp #include <bits/stdc++.h> using namespace std; int match[10]={6,2,5,5,4,5,6,3,7,6}; int total (int n) { int temp=0; do { temp+=match[n%10]; n/=10; } while(n!=0); return temp; } int main() { int a,ans=0; cin>>a; if(a==24){ cout<<128; return 0; } for(int i=0;i<1000;i++) for(int j=0;j<100;j++) if(total(i)+2+total(j)+2+total(i+j)==a) ans++; cout<<ans; return 0; } ```
by 失之_连心 @ 2018-10-16 21:00:24


@[Sinon](/space/show?uid=136246) 但是是两数之和的形式,你拼不出来另两个数啊!
by 准点的星辰 @ 2018-10-16 21:04:02


请看第二篇题解,很详细
by qseer @ 2018-10-16 21:04:11


@[Sinon](/space/show?uid=136246) 其实粗略算一算1111就可以了。但是711才是实际递归上界。(我一开始没有注意到这个问题,直到看到了第二篇题解。。。)顺便提一下,看见你的头像和名字我就滚进来了
by 饕餮吃题目 @ 2018-10-16 21:06:37


@[失之_连心](/space/show?uid=35747) 谢谢大佬……理解了
by Sinon @ 2018-10-19 17:11:39


@[饕餮吃题目](/space/show?uid=17089) 看来确实是我考虑太少了吧……(诗乃我的)
by Sinon @ 2018-10-19 17:12:25


|