| ||||||||||
| 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 | |||||||||
粗心害死人,忘了初始化max,哎#include <iostream>
using namespace std;
int main()
{
int N,i,j,f[210],begin,end,T,max,tem;
cin>>T;
while(T--)
{
max = -1;
memset(f,0,sizeof(f));
cin>>N;
for(i = 1; i<=N ;i++)
{
cin>>begin>>end;
if(begin > end)//保证开始<结束
{
tem = begin ;
begin =end;
end = tem ;
}
for(j = (begin+1)/2; j<=(end+1)/2; j++)
{
f[j]++;
if(f[j]>max)
max = f[j];
}
}
cout<<max*10<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator