关于ZJU的1029题,哪位帮着看看我的代码吧,是哪种条件没考虑到吗?为什么总是WRONG ANSWER
loewe 2003-05-16 03:01:47 #include<iostream.h>
int r[401] ; //房间
int main()
{
int j , n ; //j 表示有多少组测试数据
int i , k , t ;
int s , e , times[20] ;
//times存放结果,s为开始房间,e为结束房间号
cin >> j ;
for(i = 0 ; i < j ; i++)
{
cin >> n ;
//每次读取数据,在相应的房间上+1
for(k = 0 ; k < n ; k++)
{
cin >> s >> e ;
if(s % 2 == 0) s -= 1 ;
if(e % 2 != 0) e += 1 ;
for(t = s ; t < e ; t++)
{
r[t] += 1 ;
}
}
times[i] = r[1] ;
//取最大值的房间
for(t = 1 ; t < 400 ; t++)
{
if(r[t] > times[i]) times[i] = r[t] ;
r[t] = 0 ;
}
}
for(i = 0 ; i < j ; i++)
{
cout << times[i] * 10 << endl ;
}
return 0 ;
}