| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为啥Runtime Error??????????求救求救!!!!!!!!!!!!!!!!!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator