回答編集履歴
1
追記
test
CHANGED
@@ -41,3 +41,55 @@
|
|
41
41
|
}
|
42
42
|
|
43
43
|
```
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
[追記] 一発目でエラーなら出力しないのがご希望なら
|
48
|
+
|
49
|
+
```C
|
50
|
+
|
51
|
+
#include <stdio.h>
|
52
|
+
|
53
|
+
#include <stdbool.h>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
int main(void) {
|
58
|
+
|
59
|
+
int data, max, min;
|
60
|
+
|
61
|
+
bool at_first = true;
|
62
|
+
|
63
|
+
while ( scanf("%d", &data) == 1 ) {
|
64
|
+
|
65
|
+
if ( at_first ) {
|
66
|
+
|
67
|
+
min = data;
|
68
|
+
|
69
|
+
max = data;
|
70
|
+
|
71
|
+
at_first = false;
|
72
|
+
|
73
|
+
} else {
|
74
|
+
|
75
|
+
if (data > max) max = data;
|
76
|
+
|
77
|
+
if (data < min) min = data;
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
if ( !at_first ) {
|
84
|
+
|
85
|
+
printf("%d\n", max);
|
86
|
+
|
87
|
+
printf("%d\n", min);
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
return 0;
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
```
|