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

为啥Runtime Error??????????求救求救!!!!!!!!!!!!!!!!!!!

Posted by huhuhuhh at 2010-03-12 22:17:35 on Problem 3664
#include<iostream>
using namespace std;
int main(){
	long a[5100][20],b[5100];
	int	n,k,i,t,max;
	while(cin>>n>>k){
		for(i=0;i<n;i++){
			cin>>a[i][0]>>a[i][1];
		}
		for(i=0;i<k;i++){
			max=0;
			while(a[max][0]==-1&&max<n)
				max++;
			for(t=0;t<n;t++)
				if(a[max][0]<a[t][0]&&a[t][0]!=-1)
					max=t;
			a[max][0]=-1;
			b[i]=max;
		}
		max=b[0];
		for(i=0;i<k;i++){
			if(a[b[i]][1]>a[max][1])
				max=b[i];
		}
		printf("%d\n",max+1);
	}
	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