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

请谁帮我看一下,为什么过不了呢,我在自己的vc里面可以过啊

Posted by ndingding at 2006-11-14 19:35:50 on Problem 1716
#include<iostream>
using namespace std;



void main()
{
    int count[1001]={0},select[1001] = {0},
		
		m,n,max1[1001] ,max2[1001],p,num = 0,a,b,result = 0;
    
    cin>>p;
    while( num < p )
	{
		
        cin>>m>>n;
        max1[num] = m;
		max2[num] = n;
		
		for(int i = m; i <= n; i++)
		
			count[i]++;
			
		
        num++;
		}
   for( num = 0; num < p; num++)
   {
	   a = b = max1[num];

	   for( int i = max1[num]+1; i <= max2[num]; i++)
		   if( count[i] >= count[a])
		   {
			   b = a;
			   a = i;
		   }
		   if( !select[a] )
		   { 
			   result++;
			   select[a] = 1;
		   }
		   if( !select[b] )
		   { 
			   result++;
			   select[b] = 1;
		   }
   }

   cout<<result;



}

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