Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:Runtime Error

Posted by aFox at 2010-05-30 12:17:34 on Problem 1009 and last updated at 2010-05-30 12:17:56
In Reply To:Runtime Error Posted by:aFox at 2010-05-29 19:04:27
> RE这种错误,该从哪里入手Debug呢?
看来RE这种错误最典型的入手点是,判断数组下标是否越界。

彻底沉默,终于在RE十几次之后AC,问题很可笑:用inputs[1000][2]来接收pair数据是个bug,漏算了每组的(0 0)这一组数据;希望后来者不要犯类似错误啊。

i = 0;
while ( 1 ) {
    // 当pair为1000时,此处出错
    scanf( "%d %d", &( inputs[i][0] ), &( inputs[i][1] ) );
    if ( inputs[i][1] == 0 ) break;
    ++i;
}

32MS,算法上仍有改进余地,这就当是一次教训吧。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator