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:dynamic_study at 2009-06-30 07:38:26 > #include<iostream> > using namespace std; > int main() > { > int ncase,i,max,j,n,loop[410],a,b,temp; > cin>>ncase; > while(ncase--) > { > cin>>n; > max=0; > memset(loop,0,sizeof(loop)); > for(i=0;i<410;i++) > loop[i]=0; > for(i=0;i<n;i++) > { > > cin>>a>>b; > if(a>b) > { > temp=a; > a=b; > b=temp; > } > for(j=a;j<=b;j++) > { > loop[j]++; > if(loop[j]>=max) > { > max=loop[j]; > } > } > } > cout<<max*10<<endl; > } > return 0; > } > //未通过的测试数据,官方答案是20,我怎么觉得是10 > /* > 10 > 2 3 > 4 5 > 6 7 > 8 9 > 10 11 > 12 13 > 14 15 > 16 17 > 18 19 > 20 21 > */ Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator