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

Re:一组数组没过,帮看看

Posted by 1120101842 at 2011-07-05 09:42:11 on Problem 1083
In Reply To:一组数组没过,帮看看 Posted by:dynamic_study at 2009-06-30 07:38:26
> #include<iostream>
> using namespace std;
> int main()
> {
> 	int ncase,i,max,j,n,loop[410],a,b,temp;
> 	cin>>ncase;
> 	while(ncase--)
> 	{
> 		cin>>n;
> 		max=0;
> 		memset(loop,0,sizeof(loop));
> 		for(i=0;i<410;i++)
> 		   loop[i]=0;
> 		for(i=0;i<n;i++)
> 		{
> 
> 			cin>>a>>b;
> 			if(a>b)
> 			{
> 				temp=a;
> 				a=b;
> 				b=temp;
> 			}
> 			for(j=a;j<=b;j++)
> 			{
> 				loop[j]++;
> 				if(loop[j]>=max)
> 				{
> 					max=loop[j];
> 				}
> 			}
> 		}
> 		cout<<max*10<<endl;
> 	}
> 	return 0;
> }
> //未通过的测试数据,官方答案是20,我怎么觉得是10
> /*
> 10
> 2 3
> 4 5
> 6 7
> 8 9
> 10 11
> 12 13
> 14 15
> 16 17
> 18 19
> 20 21
> */

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