回答編集履歴

1

コードの修正

2019/07/05 21:08

投稿

kazuma-s
kazuma-s

スコア8224

test CHANGED
@@ -28,11 +28,11 @@
28
28
 
29
29
 
30
30
 
31
- typedef struct { int w_i, v_i; } Good;
31
+ typedef struct { int w_i, v_i; } Goods;
32
32
 
33
33
 
34
34
 
35
- Good *g;
35
+ Goods *g;
36
36
 
37
37
  int n, W, w, v, max_v;
38
38
 
@@ -66,9 +66,9 @@
66
66
 
67
67
  {
68
68
 
69
- Good good1[4] = { {2, 3}, {1, 2}, {3, 4}, {2, 2} };
69
+ Goods g1[4] = { {2, 3}, {1, 2}, {3, 4}, {2, 2} };
70
70
 
71
- g = good1, n = 4, W = 5, max_v = 0;
71
+ g = g1, n = 4, W = 5, max_v = 0;
72
72
 
73
73
  knapsack(0);
74
74
 
@@ -76,9 +76,9 @@
76
76
 
77
77
 
78
78
 
79
- Good good2[3] = { {2, 2}, {2, 1}, {1, 1} };
79
+ Goods g2[3] = { {2, 2}, {2, 1}, {1, 1} };
80
80
 
81
- g = good2, n = 3, W = 5, max_v = 0;;
81
+ g = g2, n = 3, W = 5, max_v = 0;;
82
82
 
83
83
  knapsack(0);
84
84