-
Notifications
You must be signed in to change notification settings - Fork 171
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
第2回課題提出 #121
base: main
Are you sure you want to change the base?
第2回課題提出 #121
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.
spear.c
works.c
が正しく動いていません.
また修正する場合は,答えだけ出力するようにしていただけると助かります.
(採点の都合ですが,大量のケースで動かすと出力がえらいことになるので...)
src/spear.c
Outdated
scanf("%d", &A[i]); | ||
if (ub < A[i]) | ||
{ | ||
ub = A[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.
初期値が不適切です.
return 0; | ||
} | ||
|
||
bool p(int x) |
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.
了解いたしました。
また、出力の方も了解です。
修正の期限の方は何時迄でしょうか?
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.
すぐに書き表せるものとしては
n=k=10
でa_i
の値が全て1
などですね.(追記:ケースを小さいものに修正しました)
後はでたらめなケースのほとんどでかなり大きめの値を出力しています.
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.
修正期限ですが,ちゃんとした日時は未定ですが,
例年では最終課題の締め切りと同じくらいです.
なので,他の課題も考慮しつつ計画的にやっていただければ大丈夫です.
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.
works
は依然いくつかのランダムケースで大きめの値を返しています.
spear
はok(=基礎課題はok)です.
return 0; | ||
} | ||
|
||
bool p(int x) |
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.
網羅は出来ていないかも知れませんが
気になったところをコメントします.
src/works.c
Outdated
temp -= A[i]; | ||
// printf("roop1(temp=%d,i=%d,count=%d)\n", temp, i, count); | ||
++i; | ||
if (temp < A[i] || i >= n) |
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.
ここを同時に処理しているのは怪しい気がします.
temp < A[i]のときは確かに良いのですが
i>=nの時も次の(外側のwhile)ループが続きcount足されてしまうので.
あとtemp<A[i]の条件式で配列外参照するのも怖いので,同じ式を書くなら
i >= n || temp < A[i]
と書いた方が良いとも思います(i>=nのとき後半実行されない)
ご指摘いただけた部分を修正しました |
課題を提出します。
ご確認のほど、よろしくお願いいたします。