1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 struct node 5 { 6 int a,b;//结构体。 7 } st[5000]; 8 int main() 9 { 10 int i,n,max,temp; 11 while(scanf("%d",&n)!=EOF) 12 { 13 max=0; 14 for(i=0; i<n; i++) 15 { 16 scanf("%d %d",&st[i].a,&st[i].b); 17 if(st[i].a==max) 18 { 19 if(st[i].b>st[temp].b)temp=i; 20 } 21 else 22 { 23 if(st[i].a>max) 24 { 25 max=st[i].a,temp=i; 26 } 27 } 28 } 29 printf("%d ",temp+1); 30 } 31 return 0; 32 }