回答編集履歴
10
最後の修正でロジック部分が元に戻ってしまっていたので修正。max = iが1回だけの記述になるよう修正
test
CHANGED
@@ -38,8 +38,6 @@
|
|
38
38
|
|
39
39
|
if(first == 1){
|
40
40
|
|
41
|
-
max = i;
|
42
|
-
|
43
41
|
first = 0;
|
44
42
|
|
45
43
|
}else if(i < max){
|
@@ -50,7 +48,9 @@
|
|
50
48
|
|
51
49
|
}
|
52
50
|
|
51
|
+
max = i;
|
52
|
+
|
53
|
-
ptr = strtok(NULL, "
|
53
|
+
ptr = strtok(NULL, " ");
|
54
54
|
|
55
55
|
}
|
56
56
|
|
9
Cだとコンパイラが1行コメントに非対応かもしれないので修正
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
char buffer[30001]; /
|
17
|
+
char buffer[30001]; /* 30000文字以上のファイルが無い前提で書いてます */
|
18
18
|
|
19
19
|
char * t = NULL;
|
20
20
|
|
8
改行文字の心配は余計だと思ったので削除
test
CHANGED
@@ -34,23 +34,19 @@
|
|
34
34
|
|
35
35
|
while(t != NULL) {
|
36
36
|
|
37
|
-
|
37
|
+
int i = atoi(t);
|
38
38
|
|
39
|
-
|
39
|
+
if(first == 1){
|
40
40
|
|
41
|
-
|
41
|
+
max = i;
|
42
42
|
|
43
|
-
|
43
|
+
first = 0;
|
44
44
|
|
45
|
-
|
45
|
+
}else if(i < max){
|
46
46
|
|
47
|
-
|
47
|
+
increasing = 0;
|
48
48
|
|
49
|
-
increasing = 0;
|
50
|
-
|
51
|
-
|
49
|
+
break;
|
52
|
-
|
53
|
-
}
|
54
50
|
|
55
51
|
}
|
56
52
|
|
7
改行文字が入ってしまっていても大丈夫なように修正(多分余計)
test
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
while(t != NULL) {
|
36
36
|
|
37
|
-
if(t[0] ==
|
37
|
+
if(t[0] == '\n'){
|
38
38
|
|
39
39
|
int i = atoi(t);
|
40
40
|
|
6
ファイル名の出力が抜けていたので直しました
test
CHANGED
@@ -34,27 +34,27 @@
|
|
34
34
|
|
35
35
|
while(t != NULL) {
|
36
36
|
|
37
|
-
|
37
|
+
if(t[0] == "\n"){
|
38
38
|
|
39
|
-
i
|
39
|
+
int i = atoi(t);
|
40
40
|
|
41
|
-
|
41
|
+
if(first == 1){
|
42
42
|
|
43
|
-
|
43
|
+
max = i;
|
44
44
|
|
45
|
-
|
45
|
+
first = 0;
|
46
46
|
|
47
|
-
|
47
|
+
}else if(i < max){
|
48
48
|
|
49
|
-
|
49
|
+
increasing = 0;
|
50
50
|
|
51
|
-
|
51
|
+
break;
|
52
52
|
|
53
|
-
|
53
|
+
}
|
54
54
|
|
55
55
|
}
|
56
56
|
|
57
|
-
t = strtok(NULL, "
|
57
|
+
ptr = strtok(NULL, ",");
|
58
58
|
|
59
59
|
}
|
60
60
|
|
@@ -62,11 +62,11 @@
|
|
62
62
|
|
63
63
|
if(increasing == 1){
|
64
64
|
|
65
|
-
printf("increasing\n");
|
65
|
+
printf("%s: increasing\n", argv[1]);
|
66
66
|
|
67
67
|
}else{
|
68
68
|
|
69
|
-
printf("not increasing\n");
|
69
|
+
printf("%s: not increasing\n", argv[1]);
|
70
70
|
|
71
71
|
}
|
72
72
|
|
5
バグ修正2
test
CHANGED
@@ -48,6 +48,10 @@
|
|
48
48
|
|
49
49
|
break;
|
50
50
|
|
51
|
+
}else{
|
52
|
+
|
53
|
+
max = i;
|
54
|
+
|
51
55
|
}
|
52
56
|
|
53
57
|
t = strtok(NULL, " ");
|
4
バグ修正
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
}
|
52
52
|
|
53
|
-
t = strtok(NULL, "
|
53
|
+
t = strtok(NULL, " ");
|
54
54
|
|
55
55
|
}
|
56
56
|
|
3
書き間違えの修正(2)
test
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
}else{
|
64
64
|
|
65
|
-
p
|
65
|
+
printf("not increasing\n");
|
66
66
|
|
67
67
|
}
|
68
68
|
|
2
書き間違いを修正
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
}
|
52
52
|
|
53
|
-
|
53
|
+
t = strtok(NULL, ",");
|
54
54
|
|
55
55
|
}
|
56
56
|
|
1
インデントを直しました
test
CHANGED
@@ -6,68 +6,66 @@
|
|
6
6
|
|
7
7
|
{
|
8
8
|
|
9
|
-
|
9
|
+
int increasing = 1;
|
10
10
|
|
11
|
-
|
11
|
+
int first = 1;
|
12
12
|
|
13
|
-
|
13
|
+
int max;
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
|
17
|
+
char buffer[30001]; // 30000文字以上のファイルが無い前提で書いてます
|
18
18
|
|
19
|
-
|
19
|
+
char * t = NULL;
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
if(NULL == fgets(buffer, sizeof(buffer) - 1, f)){
|
24
|
-
|
25
|
-
printf("%s: can't reed.\n",argv[1]); exit(-1);
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
buffer[sizeof(buffer) -1] = '¥0';
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
t = strtok(buffer, " ");
|
34
|
-
|
35
|
-
while(t != NULL) {
|
36
|
-
|
37
|
-
int i = atoi(t);
|
38
|
-
|
39
|
-
if(first == 1){
|
40
|
-
|
41
|
-
max = i;
|
42
|
-
|
43
|
-
first = 0;
|
44
|
-
|
45
|
-
}else if(i < max){
|
46
|
-
|
47
|
-
increasing = 0;
|
48
|
-
|
49
|
-
break;
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
ptr = strtok(NULL, ",");
|
54
|
-
|
55
|
-
}
|
56
20
|
|
57
21
|
|
58
22
|
|
59
|
-
|
23
|
+
if(NULL == fgets(buffer, sizeof(buffer) - 1, f)){
|
60
24
|
|
61
|
-
|
25
|
+
printf("%s: can't reed.\n",argv[1]); exit(-1);
|
62
26
|
|
63
|
-
|
27
|
+
}
|
64
28
|
|
65
|
-
|
29
|
+
buffer[sizeof(buffer) -1] = '¥0';
|
66
30
|
|
31
|
+
|
32
|
+
|
33
|
+
t = strtok(buffer, " ");
|
34
|
+
|
35
|
+
while(t != NULL) {
|
36
|
+
|
37
|
+
int i = atoi(t);
|
38
|
+
|
39
|
+
if(first == 1){
|
40
|
+
|
41
|
+
max = i;
|
42
|
+
|
43
|
+
first = 0;
|
44
|
+
|
45
|
+
}else if(i < max){
|
46
|
+
|
47
|
+
increasing = 0;
|
48
|
+
|
49
|
+
break;
|
50
|
+
|
67
|
-
|
51
|
+
}
|
52
|
+
|
53
|
+
ptr = strtok(NULL, ",");
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
if(increasing == 1){
|
60
|
+
|
61
|
+
printf("increasing\n");
|
62
|
+
|
63
|
+
}else{
|
64
|
+
|
65
|
+
puts("not increasing\n");
|
66
|
+
|
67
|
+
}
|
68
68
|
|
69
69
|
}
|
70
70
|
|
71
|
-
|
72
|
-
|
73
71
|
```
|