-
Notifications
You must be signed in to change notification settings - Fork 163
revised #182
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
base: main
Are you sure you want to change the base?
revised #182
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.
array.c apple.c spear.c が正しく動いていません.
src/array.c
Outdated
| for(i = 0; i < n; i++){ | ||
| scanf("%d", &A[i]); | ||
| } | ||
| lb = 0; |
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/apple.c
Outdated
| int i, lb, ub; | ||
| scanf("%d%d", &n, &k); | ||
| for(i = 0; i < n; i++){ | ||
| for(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.
配列は0から始まります.
(n=100000のときこれだと配列外参照します.)
src/apple.c
Outdated
| while(ub - lb > 1) { | ||
| int mid = (lb + ub) / 2; | ||
| siguma = 0; | ||
| for(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.
ここも0からでいいです.
src/spear.c
Outdated
| int i, lb, ub; | ||
| scanf("%d%d", &n, &k); | ||
| for(i = 0; i < n; i++){ | ||
| for(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.
apple.cと同じです.
|
修正しましたので確認お願いします。 |
nanashima
left a comment
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が正しい答えを返してないです.
src/spear.c
Outdated
| } | ||
|
|
||
|
|
||
| printf("%d\n", ub); |
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.
lb:k本の槍が作れると分かっている槍の長さ
ub:k本の槍が作れないと分かっている槍の長さ
としているならば,出力すべきはk本の槍が作れる槍の長さの最大値なのでlbです.
src/spear.c
Outdated
| scanf("%d", &A[i]); | ||
| } | ||
| lb = 0; | ||
| ub = 1000000000; |
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.
その場合長さ10^9の槍はまだ作れる可能性があるので,この初期値は不適切です.
(長さ10^9の木から長さ10^9の槍は作れる)
|
再修正しましたので確認お願いいたします。 |
仕事の配分が難しかったです。