注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
这个是smark news 第一面的题目
. 1point 3 acres
# #
# # For an int N (N>0), figure out how many ways you can split it into one or mutiple adders..google и
# # 1) adder > 0 int
# # 2) adder order does not matter
# #
# # 1 = 1
# # S(1) = 1
# # . .и
# # 2 = 2
# # 2 = 1 + 1 ..
# # S(2) = 2
# # .1point3acres
. .и
# # 3:
# # 3 = 3 ..
# # 3 = 2 + 1
# # 3 = 1 + 1 + 1
# # S(3) = 3
#
# # 4 :
# # 1) 4 = 4. Waral dи,
# # 2) 4 = 3 + 1
# # 3) 4 = 2 + 2
# # 4) 4 = 2 + 1 + 1
# # 5) 4 = 1 + 1 + 1 + 1
# . 1point 3acres
# # S(4) = 5
# .1point3acres
# # 5:
# # 5 = 5 . Waral dи,
# # 5 = 4(5-1) + 1
# # 5 = 3(5-2) + 2. 1point3acres
# # 5 = 3 + 1 + 1
# # 5 = 2 + 2 + 1 = 1 + 2 + 2
# # 5 = 2 + 1 + 1 + 1
# # 5 = 1 + 1 + 1 + 1 + 1
# # S(5) = 7. From 1point 3acres bbs
# . 1point3acres.com
. Waral dи,
# # 6:
# # 6 = 6. Waral dи,
# # 6 = 5 + 1
# # 6 = 4 + 2
# # 6 = 4 + 1 + 1
# # 6 = 3 + 2 + 1
# # 6 = 3 + 1 + 1 + 1
# # 6 = 3 + 3
# # 6 = 2 + 2 + 2;
# # 6 = 2 + 2 + 1 + 1;
# # 6 = 2 + 1 + 1 + 1 + 1;.
# # 6 = 1 + 1 + 1 + 1 + 1
#7 = 7 .
#7 = 6 + 1
#7 = 5 + 2
#7 = 5 + 1 + 1
#7 = 4 + 3
#7 = 4 + 2 + 1
#7 = 4 + 1 + 1 + 1
#7 = 3 + 3 + 1
#7 = 3 + 2 + 2
#7 = 3 + 2 + 1 + 1 . 1point 3acres
#7 = 3 + 1 + 1 + 1 + 1
#7 = 2
#
# # S(6) = 11. ----
# #
# # S(n) = ?
|