#25568: 求救


chuan53 (eggMan)

學校 : 臺北市私立薇閣高級中學
編號 : 90787
來源 : [140.112.24.187]
最後登入時間 :
2023-10-31 17:19:37
d040. 11207 - The easiest way -- UVa11207 | From: [220.136.80.26] | 發表日期 : 2021-06-02 17:04

#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;

但這樣就暴斃,求解!

 
ZeroJudge Forum