奇怪,明明是EOF 結尾啊!
他說我在第二筆測資多輸出了一個0
奇怪?
//================================= MY CODE:
#include <stdio.h>
int main () {
int a, b, c, tmp;
int T = 5, ans;
while (scanf("%d%d%d", &a, &b, &c) != EOF) {
//---------------------1
ans = 0;
if (a > b) {
tmp = b; b = a; a = tmp;
}
if (b > c) {
tmp = c; c = b; b = tmp;
}
if ((a + b) > c) {
ans++;
}
//--------------------2
scanf("%d%d%d", &a, &b, &c);
if (a > b) {
tmp = b; b = a; a = tmp;
}
if (b > c) {
tmp = c; c = b; b = tmp;
}
if ((a + b) > c) {
ans++;
}
//---------------------3
scanf("%d%d%d", &a, &b, &c);
if (a > b) {
tmp = b; b = a; a = tmp;
}
if (b > c) {
tmp = c; c = b; b = tmp;
}
if ((a + b) > c) {
ans++;
}
//---------------------4
scanf("%d%d%d", &a, &b, &c);
if (a > b) {
tmp = b; b = a; a = tmp;
}
if (b > c) {
tmp = c; c = b; b = tmp;
}
if ((a + b) > c) {
ans++;
}
//--------------------5
scanf("%d%d%d", &a, &b, &c);
if (a > b) {
tmp = b; b = a; a = tmp;
}
if (b > c) {
tmp = c; c = b; b = tmp;
}
if ((a + b) > c) {
ans++;
}
printf("%d\n", ans);
}
return 0;
}