Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

粗心害死人,忘了初始化max,哎

Posted by 508618087 at 2013-04-02 14:52:29 on Problem 1083
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator