-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd.cpp
More file actions
43 lines (43 loc) · 873 Bytes
/
Copy pathd.cpp
File metadata and controls
43 lines (43 loc) · 873 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
32
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
using namespace std;
double xie(int a,int b,int c,int d)
{
if((c-a)==0) return 100000;
else
{
double num=(double)(d-b)/(c-a);
return num;
}
}
int main()
{
int T;
cin>>T;
while(T--)
{
int n;
cin>>n;
int a[n][2];
for(int i=0;i<n;i++)
{
for(int j=0;j<2;j++)
{
cin>>a[i][j];
}
}
double num=10000000;
for(int i=0;i<n-1;i++)
{
for(int j=i+1;j<n;j++)
{
double temp=xie(a[i][0],a[i][1],a[j][0],a[j][1]);
if(temp==100000)
continue;
if(num>temp)
num=temp;
}
}
printf("%.3lf\n",num);
}
return 0;
}