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:求解答。。多次提交仍然WRONG啊In Reply To:求解答。。多次提交仍然WRONG啊 Posted by:20116096 at 2012-07-23 10:54:01 > #include<iostream> > using namespace std; > > > int main() > { > int M; > int max=0; > cin>>M; > while(M--) > { > int i,n,k,l; > int id[201]={0}; //l个需要搬动的桌子,起始n,中止k > cin>>l; > while(l--) > { > cin>>n>>k; > if(n>k) > { > i=n;n=k;k=i; //交换小值n在前 > } > int start,end; > if(n%2!=0)start=n/2+1;else start=n/2; > if(k%2!=0)end=k/2+1;else end=k/2; > for(i=start;i<=end;i++) > id[i]++; > > > > } > for(i=0;i<201;i++) > if(max<id[i]) > max=id[i]; > cout<<max*10<<endl; > } > return 0; > } 在每个M循环里你的max没有清零 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator