[InterviewStreet] Lego Blocks (50 Points)# JobHunting - 待字闺中
v*a
1 楼
Define:
C[i]: Total different number of blocks when height_1 weight_i. Including non
-solid structure. Like Fibonacci, number:
C[i] = C[i - 1] + C[i - 2] + C[i - 3] + C[i - 4]
B[i]: Total different number of blocks when height_N weight_i. Including non
-solid structure. Please use the O(LogN) method to calculate power:
B[i] = power( C[i], N )
A[i]: Total different number of blocks when height_N weight_i. Only SOLID
structure.
A[i] = B[i] - Sum(A[j] * B[i - j] | for j = 1 to (i - 1, inclusive))
A[M] is the answer.
tips:
1) use (...) % Mod everywhere.
2) use int64 or long long, because you need to use multiple.
很不好意思,突然发现这是个烙印的startup,所以如果他知道你不是印度人的话,有
些……都懂得
但是大家自己可以去公司的网站自己apply,把成绩贴上去
团结,被烙印欺负了,不还手就有些不爽了!
C[i]: Total different number of blocks when height_1 weight_i. Including non
-solid structure. Like Fibonacci, number:
C[i] = C[i - 1] + C[i - 2] + C[i - 3] + C[i - 4]
B[i]: Total different number of blocks when height_N weight_i. Including non
-solid structure. Please use the O(LogN) method to calculate power:
B[i] = power( C[i], N )
A[i]: Total different number of blocks when height_N weight_i. Only SOLID
structure.
A[i] = B[i] - Sum(A[j] * B[i - j] | for j = 1 to (i - 1, inclusive))
A[M] is the answer.
tips:
1) use (...) % Mod everywhere.
2) use int64 or long long, because you need to use multiple.
很不好意思,突然发现这是个烙印的startup,所以如果他知道你不是印度人的话,有
些……都懂得
但是大家自己可以去公司的网站自己apply,把成绩贴上去
团结,被烙印欺负了,不还手就有些不爽了!