Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- double g1[1010],g2[1010];
- double sum = 10000000.0;
- int main(){
- int n,m;
- scanf("%d %d",&n,&m);
- for(int i=0;i<n;i++){
- scanf("%lf %lf",&g1[i],&g2[i]);
- }
- for(int i=0;i<m;i++){
- double a,b;
- scanf("%lf %lf",&a,&b);
- for(int j=0;j<n;j++){
- double x=g1[j]-a,y=g2[j]-b;
- double sav = sqrt((x*x)+(y*y));
- if(sav<sum){sum=sav;}
- }
- }
- printf("%.3f",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement