Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请教:为什么while (!cin.eof())不行,而while (cin >> a >> b)就可以了(附源码)?int main() { int a, b, temp, max; //while (!cin.eof()) { //这样写提交是WA while (cin >> a >> b) { //这样写提交就AC了,Why? cin >> a >> b; cout << a << " " << b << " "; if (a > b) { temp = a; a = b; b = temp; } max = 0; for (int i = a; i <= b; ++i) { int cur = get_cycle(i); if (cur > max) max = cur; } cout << max << endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator