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

What problem!!!!

Posted by huangyue123456 at 2005-12-13 21:04:15 on Problem 1828
#include<stdio.h>
#include<math.h>

void main()
{
	int n,i,j,k,a[50000][2],min,p,num=0,temp;
	
	scanf("%d",&n);
	for(;;)
	{
		num=0;
		if(n==0)
			break;
	for(i=0;i<n;i++)
	{
	
		for(j=0;j<2;j++)
		{
		   scanf("%d",&a[i][j]);
		}
	}
	
	for(i=0;i<n;i++)
	{
		k=i+1;
		min=i;
		for(j=k;j<n+1;j++)
		{
			if(a[j][0]<a[min][0])
		        min=j;
		}
		temp=a[j][0];
		a[j][0]=a[min][0];
		a[min][0]=temp;
	}
	for(i=0;i<n;i++)
	{
		p=n-1;
		if(a[i][0]+a[i][1]>a[p][0]+a[p][1])
		{
			printf("0\n");
			break;
		}
		if(a[i][0]+a[i][1]==a[p][0]+a[p][1])
			num++;
		
	}
	printf("%d\n",num);
	}

	
}

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