Skip to content
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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

revised #182

wants to merge 8 commits into from

Conversation

onzw
Copy link

@onzw onzw commented Jun 28, 2022

仕事の配分が難しかったです。

Copy link

@nanashima nanashima left a 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;

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++){

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++){

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++){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apple.cと同じです.

@onzw
Copy link
Author

onzw commented Jul 5, 2022

修正しましたので確認お願いします。

Copy link

@nanashima nanashima left a 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);
Copy link

@nanashima nanashima Jul 16, 2022

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;

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の槍は作れる)

@onzw
Copy link
Author

onzw commented Aug 8, 2022

再修正しましたので確認お願いいたします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants