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 |
Re:头晕了,,,实在看不出错误。。。请教一下,,谢谢In Reply To:头晕了,,,实在看不出错误。。。请教一下,,谢谢 Posted by:iowyh at 2006-04-05 10:30:53 你这个输入 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 会出来什么 > #include<iostream> > using namespace std; > int main() > { > __int64 n,i,pre,aft,rpre,raft,min,tempmin,x; > __int64 sum,result; > > > scanf("%I64d\n",&n); > scanf("%I64d\n",&x); > sum=x; > min=x; > result=x*x; > pre=1; > aft=1; > rpre=1; > raft=1; > for(i=2;i<=n;i++) > { > scanf("%I64d",&x); > tempmin=x>min?min:x; > if(x*x>tempmin*(sum+x)) > { > pre=i; > aft=i; > sum=x; > min=x; > } > else > { > aft++; > min=tempmin; > sum+=x; > } > if(sum*min>result) > { > result=sum*min; > rpre=pre; > raft=aft; > } > } > printf("%I64d\n%I64d %I64d\n",result,rpre,raft); > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator