葉林
Linked with GitHub
# ZeroJudge - d038: 00900 - Brick Wall Patterns ### 題目連結:https://zerojudge.tw/ShowProblem?problemid=d038 ###### tags: `ZeroJudge` `動態規劃(Dynamic Programming)` ```cpp= #include <iostream> using namespace std; long long fibonacci[51] = { 1, 1 }; void Initialize() { for (int i = 2; i < 51; ++i) fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]; } int main() { cin.sync_with_stdio(false); cin.tie(nullptr); Initialize(); int length; while (cin >> length, length) cout << fibonacci[length] << '\n'; } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up