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:为什么这样用个memset函数就不行了呢?In Reply To:为什么这样用个memset函数就不行了呢? Posted by:jianzhi at 2011-10-05 16:05:28 > #include<iostream> > using namespace std; > void test_1083() > { > int T; > cin>>T; > int N; > > int max=-1; > unsigned start,end; > while(T--){ > cin>>N; > int corridor[201]={0}; > for(int i=0;i!=N;++i){ > cin>>start>>end; > if(start>end){ > int temp=end; > end=start; > start=temp; > } > for(int j=(start+1)/2;j!=(end+1)/2+1;++j){ > ++corridor[j]; > } > } > for(int i=1;i!=201;++i){ > if(corridor[i]>max) > max=corridor[i]; > } > cout<<max*10<<endl; > //memset(corridor,0,201); > max=-1; > } > } > int main() > { > test_1083(); > } > 这样行但是为什么这样Wrong Answer呢? > #include<iostream> > using namespace std; > void test_1083() > { > int T; > cin>>T; > int N; > int corridor[201]={0}; > int max=-1; > unsigned start,end; > while(T--){ > cin>>N; > for(int i=0;i!=N;++i){ > cin>>start>>end; > if(start>end){ > int temp=end; > end=start; > start=temp; > } > for(int j=(start+1)/2;j!=(end+1)/2+1;++j){ > ++corridor[j]; > } > } > for(int i=1;i!=201;++i){ > if(corridor[i]>max) > max=corridor[i]; > } > cout<<max*10<<endl; > memset(corridor,0,201); > max=-1; > } > } > int main() > { > test_1083(); > } 没有加头文件。。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator