| ||||||||||
| 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:很奇怪的WA与ACIn Reply To:很奇怪的WA与AC Posted by:Rieman at 2010-12-17 16:42:14 > n=2时应该只输入一个数,但是if(n>2) cin>>last WA了,光cin>>last却是AC的,奇也怪哉~
>
> #include <iostream>
> using namespace std;
> const int inf=(int)50001,maxint=(int)10e8;
> int main()
> {
> int n,mini,pre,now,i,last,a;
> cin>>n;
> mini=maxint;
> cin>>pre;
> for(i=2;i<n-1;i++)
> {
> scanf("%d",&now);
> if(mini>now-pre)
> mini=now-pre,a=i;
> pre=now;
> }
> if(n>2) //n=2时应该只输入一个数;
> cin>>last;
> if(n<4)
> cout<<0<<endl;
> else
> {
> cout<<last+mini<<endl;
> printf("%d 1 %d %d\n",a+1,n,a);
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator