-
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
revised #182
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
int main(){ | ||
int i, lb, ub; | ||
scanf("%d%d", &n, &k); | ||
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 main(){ | ||
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
@@ -8,10 +8,26 @@ int A[100000]; | |||
int main(){ | |||
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
と同じです.
修正しましたので確認お願いします。 |
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
@@ -11,7 +11,23 @@ int main(){ | |||
for(i = 0; i < n; i++){ | |||
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の槍は作れる)
再修正しましたので確認お願いいたします。 |
仕事の配分が難しかったです。