ACM 基本算法---递推
文章平均质量分 64
Angel_XiaoXiong
算法渣渣
展开
-
poj2506Tiling
http://poj.org/problem?id=2506 递推:f(n)=f(n-1)+2f(n-2) #include struct node { int a[10000]; }s[300]; int main() { int c,n,i,j,cot=1; long long temp; s[0].a[0]=1; s[1].a[0]=1; for(i=2;i<260;i原创 2016-05-29 17:33:50 · 411 阅读 · 0 评论 -
poj1747Expression
http://poj.org/problem?id=1747 给出一个函数 要求找出各位的表示方法 判断是否能进位。 记*为n=k-1时的表达式, 则n=k时,表达式为 ((An-1|Bn-1)|(*|((An-1|An-1)|(Bn-1|Bn-1))))。 递归函数的结构为:先输出*左边的部分,然后输出*,再输出*右边的部分。 边界条件为n=1,此时表达式为((A0|B0)|(A原创 2016-05-29 19:46:07 · 305 阅读 · 0 评论 -
山东理工OJ 1243 母牛的故事
根据题意,先列出前几年的牛头数,试着找找规律: 第n年: n=1 n=2 n=3 n=4 n=5 n=6 n=7 n=8 n=9 fn头牛? f1=1 f2=2 f3=3原创 2016-07-27 20:20:21 · 604 阅读 · 0 评论