回答編集履歴

1

ちょい修正

2020/06/25 06:41

投稿

asm
asm

スコア15149

test CHANGED
@@ -22,25 +22,39 @@
22
22
 
23
23
  ```c
24
24
 
25
- ed[i*2].next = NULL;
25
+ //点ラベル対(枝)を読み込み
26
26
 
27
- ed[i*2].label = c2;
27
+ for(i=0;i<n;i++){
28
28
 
29
- ed[i*2+1].next = NULL;
29
+ scanf("%c%*c %c%*c",&c1,&c2);
30
30
 
31
+ int C1,C2;
32
+
33
+ for(C1=0; C1 < n && grp.vset[C1].label != c1;) C1++;
34
+
35
+ for(C2=0; C2 < n && grp.vset[C2].label != c2;) C2++;
36
+
37
+ ed[i*2].next = NULL;
38
+
39
+ ed[i*2].label = c2;
40
+
41
+ ed[i*2+1].next = NULL;
42
+
31
- ed[i*2+1].label = c1;
43
+ ed[i*2+1].label = c1;
32
44
 
33
45
 
34
46
 
35
- struct edge **np;
47
+ struct edge **np;
36
48
 
37
- for( np = &grp.vset[c1].link; *np != NULL; np = &np->next) ;
49
+ for( np = &grp.vset[C1].link; *np != NULL;) np = &(*np)->next;
38
50
 
39
- *np = &ed[i*2];
51
+ *np = &ed[i*2];
40
52
 
41
- for( np = &grp.vset[c2].link; *np != NULL; np = &np->next) ;
53
+ for( np = &grp.vset[C2].link; *np != NULL;) np = &(*np)->next;
42
54
 
43
- *np = &ed[i*2+1];
55
+ *np = &ed[i*2+1];
56
+
57
+ }
44
58
 
45
59
  ```
46
60