Redian新闻
>
[InterviewStreet] Lego Blocks (50 Points)
avatar
[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,把成绩贴上去
团结,被烙印欺负了,不还手就有些不爽了!
avatar
q*x
2
看不懂题目。

non
non

【在 v***a 的大作中提到】
: 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))

avatar
q*p
3
谢谢viisa这么认真写报告来帮助找不到思路的朋友~
我第一次用O(N)的球Power也过了。但O(LogN)的二分求法确实快不少。

non
non

【在 v***a 的大作中提到】
: 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))

avatar
l*i
4
If you look at the leader board, most top 10 are from China.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。