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:一个关于 Pascal 的问题 弱弱的问???

Posted by jiali at 2005-08-14 08:55:28 on Problem 2559
In Reply To:一个关于 Pascal 的问题 弱弱的问??? Posted by:zdker at 2005-08-13 17:35:05
> var s,t:int64;
> Result:Wrong Answer
>     for i:=1 to n do
>       begin
>         s:=a[i]*(right[i]-left[i]+1);
>         if s>t then t:=s;
>       end;
> Result:Accepted
>     for i:=1 to n do
>       begin
>         s:=right[i]-left[i]+1;
>         if a[i]*s>t then t:=a[i]*s;
>       end;
> 这两个究竟有什么不同??郁闷啊!!!!!!!!
有人说这一个式子
a[i]*(right[i]-left[i]+1)
在计算时中间变量会超出范围,你的a,right和left不是64位的吧?那么计算此式时计算机分配的中间变量就不是64位的,于是就会超出范围。

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