-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第4章の練習問題「Fibonatti Number」を修正 #29
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっと確認お願いします!
@@ -24,7 +26,7 @@ int main() { | |||
int n; | |||
cin >> n; | |||
int second_latest = 0, latest = 1; | |||
for (int i = 2; i < n; i++) { | |||
for (int i = 1; i < n; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
回数のためにしか使ってないなら
for (int i = 1; i < n; i++) { | |
for (int i = 0; i < n-1; i++) { |
for (int i = 1; i < n; i++) { | |
for (int i = 2; i <= n; i++) { |
としたいです
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
返信遅くなりすみません.
i番目を計算するほうが分かりやすいと思うので, その旨のコメントを追加して以下でどうでしょうか.
for (int i = 1; i < n; i++) { | |
for (int i = 2; i <= n; i++) { | |
// i番目を計算 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さげ!コミットしちゃってください
@@ -44,11 +46,11 @@ int main() { | |||
int n; | |||
cin >> n; | |||
vector<int> fibonatti_sequence = {0, 1}; | |||
for (int i = 2; i < n; i++) { | |||
for (int i = 1; i < n; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同様
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上と同様です.
for (int i = 1; i < n; i++) { | |
for (int i = 2; i <= n; i++) { | |
// i番目を計算 |
フィボナッチ数列のi番目を計算していることが分かりやすいようにした.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM です ありがとう
何をしたか
整数N
→正の整数N