#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
while(n){
int curmax=0, pos;
for(int i=1 ;i <=n; i++){
double temp,temp2;
cin>>temp>>temp2;
double k=max(min(min(temp,temp2),max(temp,temp2)/4), min(temp,temp2)/2);
if(curmax<k){
curmax=k;
pos=i;
}
}
cout<<pos<<endl;
cin>>n;
}
}
用python同個邏輯會AC;
但這樣就暴斃,求解!