import Foundation Foundation int main int argc const char argv autorel

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
const int m = 5; //количество дуг
const int n = 4; //количесвто вершин
int I[m] = {0, 1, 2, 1, 0};
int J[m] = {1, 2, 3, 3, 2};
int H[n], L[m];
NSLog(@"Был список дуг:");
for (int i = 0; i < m; i++) {
NSLog(@"%d %d", I[i], J[i]);
}
for (int i = 0; i < n; i++) {
H[i] = -1;
}
int i;
for (int k = 0; k < m; k++ ) {
i = I[k];
L[k] = H[i];
H[i] = k;
}
NSLog(@"Стал:");
for (int i; i < m; i++) {
if (i == 4) {
NSLog(@"%d %d %d", I[i], J[i], L[i]);
} else {
NSLog(@"%d %d %d %d", I[i], J[i], H[i], L[i]);
}
}
}
return 0;
}