6261:汉诺塔问题

2 a b c

a->1->c
a->2->b
c->1->b

3089:爬楼梯

1755:菲波那契数列

2705:扩号匹配问题

# Openjudge 逆波兰表达式

1696:逆波兰表达式

* + 11.0 12.0 + 24.0 35.0

1357.000000

# 程序设计与算法（二）递归部分总结

666:放苹果 http://noi.openjudge.cn/ch0202/666/
1751:分解因数 http://noi.openjudge.cn/ch0202/1751/

# MOOC学习递归中涉及动态规划部分经典题目

2017-07-14更新放苹果问题：参考http://www.cnblogs.com/wxgblogs/p/5742618.html

 12345 f(m,n)={ m==0||n==1 -> 1; m f(m,m); //将m个苹果装到多于m个的盘子中必定不能装满，所以把m个苹果装到m个盘子里就好 m>=n -> f(m-n,n) + f(m,n-1); //分成两种情况，f(m-n,n)是没有空盘子：把n个盘子里每个都装上一个苹果，剩下的m-n个苹果再装到n个盘子里；f(m,n-1)是有空盘子，把那一个不装扔出来就好。 }

 123456 f(m,n)={ m==1|| n==1 -> 1; //m==1时，只能分成1个1；n==1时,只能分成m个1。 m f(m,m); //n>m时，将n调至m m==n -> 1+f(m,n-1); //当m==n时，因为整数m可以自己算作一个划分，那么就要把n-1传递下去 m>n -> f(m-n,n)+f(m,n-1); //m>n时，可以在当前状态下分出去n或者不分出去n，对应两个f(); }

 123456 f(m,n)={ n==1 -> 0; //划到1就不能再往下分了 m==1 -> 1; m%n==0 -> f(m/n,n) + f(m,n-1); //当m可以整除n的时候，可以除完了划分下去，也可以不除 m%n!=0 -> f(m,n-1); //只能不除 }

# Openjudge Boolean Expressions

Boolean Expressions

The objective of the program you are going to produce is to evaluate boolean expressions as the one shown next:
Expression: ( V | V ) & F & ( F | V )

where V is for True, and F is for False. The expressions may include the following operators: ! for not , & for and, | for or , the use of parenthesis for operations grouping is also allowed.

To perform the evaluation of an expression, it will be considered the priority of the operators, the not having the highest, and the or the lowest. The program must yield V or F , as the result for each expression in the input file.

The expressions are of a variable length, although will never exceed 100 symbols. Symbols may be separated by any number of spaces or no spaces at all, therefore, the total length of an expression, as a number of characters, is unknown.

The number of expressions in the input file is variable and will never be greater than 20. Each expression is presented in a new line, as shown below.

For each test expression, print “Expression ” followed by its sequence number, “: “, and the resulting value of the corresponding test expression. Separate the output for consecutive test expressions with a new line.

Use the same format as that shown in the sample output shown below.

( V | V ) & F & ( F| V)
!V | V & V & !F & (F | V ) & (!F | F | !V & V)
(F&F|V|!V&!F&!(F|F&V))

Expression 1: F
Expression 2: V
Expression 3: V

México and Central America 2004

# Openjudge 2的幂次方表示

2的幂次方表示

137=27+23+20

2(7)+2(3)+2(0)

3=2+20

2(2(2)+2+2(0))+2(2+2(0))+2(0)

1315=210+28+25+2+1

2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)

137

2(2(2)+2+2(0))+2(2+2(0))+2(0)

NOIP1998复赛 普及组 第一题

# Openjudge全排列题解

s1 = t1, s2 = t2, …, sp – 1 = tp – 1, sp < tp成立。

abc

abc
acb
bac
bca
cab
cba