-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI.cpp
More file actions
31 lines (30 loc) · 688 Bytes
/
Copy pathI.cpp
File metadata and controls
31 lines (30 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
double solve(pair<int,int> p,double r){
double x=max(abs(p.first),abs(p.second));
if(x==0) return 0;
if(r==0)return 1e19;
return x/r;
}
int main(){
freopen("balloons.in","r",stdin);
freopen("out.txt","w",stdout);
int T;cin>>T;
while(T--){
int N;cin>>N;
pair<int,int>c;
int ans=-1;
double tmp=0,best=1e9;
double r;
for(int i=0;i<N;i++){
cin>>c.first>>c.second;
cin>>r;
tmp=solve(c,r);
if(tmp<best){
best=tmp;
ans=i+1;
}
}
cout<<ans<<endl;
}
}