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