回答編集履歴
1
コードの修正
test
CHANGED
@@ -40,13 +40,15 @@
|
|
40
40
|
|
41
41
|
if (argc != 2) return 1;
|
42
42
|
|
43
|
-
char *a = argv[1];
|
44
|
-
|
45
|
-
int num = atoi(a), min, max, prev = -1;
|
43
|
+
int num = atoi(argv[1]), min, max, prev = -1;
|
46
44
|
|
47
45
|
if (num <= 0 || num > 9999) return 2;
|
48
46
|
|
47
|
+
char a[5];
|
48
|
+
|
49
49
|
for (;;) {
|
50
|
+
|
51
|
+
sprintf(a, "%04d", num);
|
50
52
|
|
51
53
|
sort4(a);
|
52
54
|
|
@@ -66,8 +68,6 @@
|
|
66
68
|
|
67
69
|
printf("%04d - %04d = %d\n", max, min, num);
|
68
70
|
|
69
|
-
sprintf(a, "%04d", num);
|
70
|
-
|
71
71
|
}
|
72
72
|
|
73
73
|
}
|