質問編集履歴
6
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
|
1
|
+
int enemy_x[]=new int[10], enemy_y[]=new int[10];
|
2
2
|
|
3
|
-
|
3
|
+
int enemy_speed[]=new int[10];
|
4
4
|
|
5
|
-
|
5
|
+
int enemy_hp[]=new int[10];
|
6
6
|
|
7
|
-
|
7
|
+
void setup(){
|
8
8
|
|
9
|
-
|
9
|
+
size(500,500);
|
10
10
|
|
11
|
-
|
11
|
+
for(int i=0;i<10;i++){
|
12
12
|
|
13
|
-
|
13
|
+
enemy_x[i]=int(random(width));
|
14
14
|
|
15
|
-
|
15
|
+
enemy_y[i]=-50;
|
16
16
|
|
17
|
-
|
17
|
+
enemy_speed[i]=int(random(2,6));
|
18
18
|
|
19
|
-
|
19
|
+
enemy_hp[i]=100;
|
20
20
|
|
21
|
-
|
21
|
+
}
|
22
22
|
|
23
23
|
}
|
5
ミスを見つけた
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,42 +1,22 @@
|
|
1
|
-
|
1
|
+
void bubble(int a[], int n) {
|
2
2
|
|
3
|
-
|
3
|
+
int i, j, temp;
|
4
4
|
|
5
|
+
for (i = 0; i < n - 1; i++) {
|
5
6
|
|
7
|
+
for (j = n - 1; j > i; j--) {
|
6
8
|
|
9
|
+
if (a[j - 1] < a[j]) {
|
7
10
|
|
11
|
+
temp = a[j - 1];
|
8
12
|
|
13
|
+
a[j - 1] = a[j];
|
9
14
|
|
15
|
+
a[j] = temp;
|
10
16
|
|
11
|
-
}
|
17
|
+
}
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
for (i = 0; i < nx; i++) {
|
16
|
-
|
17
|
-
idx = x[i] % 14;
|
18
|
-
|
19
|
-
temp = malloc(sizeof(Node));
|
20
|
-
|
21
|
-
temp->data = x[i];
|
22
|
-
|
23
|
-
table[idx] = temp;
|
24
|
-
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
for (i = 0; i < 13; i++) {
|
30
|
-
|
31
|
-
printf("%d: ", i);
|
32
|
-
|
33
|
-
if (table[i] != NULL) {
|
34
|
-
|
35
|
-
printf(" %d", table[i]->data);
|
36
18
|
|
37
19
|
}
|
38
|
-
|
39
|
-
printf("\n");
|
40
20
|
|
41
21
|
}
|
42
22
|
|
4
ミスを見つけた
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
c言語
|
1
|
+
c言語 基礎
|
test
CHANGED
File without changes
|
3
ミスを見つけた
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,31 +4,13 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
typedef struct __node {
|
8
7
|
|
9
|
-
int data;
|
10
8
|
|
11
|
-
} Node;
|
12
9
|
|
13
|
-
int main(void) {
|
14
|
-
|
15
|
-
Node *table[10];
|
16
|
-
|
17
|
-
Node *temp;
|
18
|
-
|
19
|
-
int x[] = { 1, 25, 3, 12, 34, 15, 5, 9, 11, 31 };
|
20
|
-
|
21
|
-
int nx = sizeof(x) / sizeof(int);
|
22
|
-
|
23
|
-
int i, idx; // ハッシュ表の初期化
|
24
|
-
|
25
|
-
for (i = 0; i < 13; i++) {
|
26
|
-
|
27
|
-
table[i] = NULL;
|
28
10
|
|
29
11
|
}
|
30
12
|
|
31
|
-
|
13
|
+
|
32
14
|
|
33
15
|
for (i = 0; i < nx; i++) {
|
34
16
|
|
@@ -42,7 +24,7 @@
|
|
42
24
|
|
43
25
|
}
|
44
26
|
|
45
|
-
|
27
|
+
|
46
28
|
|
47
29
|
for (i = 0; i < 13; i++) {
|
48
30
|
|
@@ -59,27 +41,3 @@
|
|
59
41
|
}
|
60
42
|
|
61
43
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
このプログラムはハッシュ法で数字を13で割り余りをidxに入れて行っているものです。
|
68
|
-
|
69
|
-
ここからハッシュ値が同じとなる値を線形リストで管理するチェイン法を作りたいです。
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
typedef struct __node { int data;
|
76
|
-
|
77
|
-
struct __node *next;
|
78
|
-
|
79
|
-
} Node;
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
に変更して行いたいです。
|
84
|
-
|
85
|
-
ヒントややり方を教えて欲しいです。
|
2
誤字
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
チェイン法の基礎
|
1
|
+
c言語 チェイン法の基礎
|
test
CHANGED
@@ -82,6 +82,4 @@
|
|
82
82
|
|
83
83
|
に変更して行いたいです。
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
やり方
|
85
|
+
ヒントややり方を教えて欲しいです。
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
for (i = 0; i < nx; i++) {
|
34
34
|
|
35
|
-
idx = x[i] % 1
|
35
|
+
idx = x[i] % 14;
|
36
36
|
|
37
37
|
temp = malloc(sizeof(Node));
|
38
38
|
|