想請教下列程式哪裡有問題後面大的測資都過但前三個會少輸出 :0#include#include//#pragma GCC optimize("Ofast,unroll-loops,fast-math")#define int long long#define getchar getchar_unlocked#define putchar putchar_unlockedusing namespace std;inline int read() {char ch = getchar();if (ch == EOF) return EOF;int s = 1;while (ch < '0' || '9' < ch) {if (ch == '-') {ch = getchar();s = -1;break;}ch = getchar();}int r = 0;while ('0' <= ch && ch <= '9') r = r * 10 + ch - '0', ch = getchar();return r * s;}void write(int x) {if (x < 0) putchar('-'), x *= -1;if (x > 9) write(x / 10);putchar(x % 10 + '0');}signed main() {int y1, x1, y2, x2, r;y1 = read();while (y1 != EOF) {x1 = read(), y2 = read(), x2 = read(), r = read();if (abs(y1 - y2) + abs(x1 - x2) <= r) printf("die\n");else printf("alive\n");y1 = read();}return 0;}
已解決
原來EOF就是-1啊
所以會在第一個座標是-1時被打斷
又學到了新東西:D