9 solutions

  • 8
    @ 2023-9-16 22:02:03
    #include <bits/stdc++.h>
    using namespace std;
    double xa,xb,ya,yb,x,y;
    int main(){
    	cin>>xa>>ya>>xb>>yb;
    	x=xb-xa;
    	y=yb-ya;
    	long double len=sqrt(x*x+y*y);
    	cout<<fixed<<setprecision(3)<<len<<endl;
    	return 0;
    }
    
    • 2
      @ 2023-10-6 19:05:25
      一共就三个头文件不难背吧,这题目感觉用万能头有点浪费时间
      数学学渣没学勾股定理,借鉴了一下前面大佬的代码
      #include <iomanip>
      #include <cmath>
      using namespace std;
      double a1,a2,b1,b2,x,y;
      int main(){
      	cin>>a1>>a2>>b1>>b2;
      	x=b1-a1;
      	y=b2-a2;
      	long double len=sqrt(x*x+y*y);
      	cout<<fixed<<setprecision(3)<<len<<endl;
      	return 0;
      }
      
      • 2
        @ 2023-9-19 19:29:21
        #include <bits/stdc++.h>
        using namespace std;
        int main(int argc, char **argv){
        	double x1,y1,x2,y2;
        	cin >> x1 >> y1 >> x2 >> y2;
        	printf("%.3f",sqrt(pow(x2 - x1,2) + pow(y2 - y1,2)));
        	return 0;
        }
        
        • 2
          @ 2023-9-10 16:40:18
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          using namespace std;
          int main(){
          	double xa,xb,ya,yb,x,y;
          	cin>>xa>>ya>>xb>>yb;
          	x=abs(xb-xa);
          	y=abs(yb-ya);
          	cout << fixed << setprecision(3)<<sqrt(x*x+y*y);
          	return 0;
          }
          
          
          • 1
            @ 2024-7-9 19:50:25
            #include<bits/stdc++.h>
            using namespace std;
            int main(){
            	double Xa,Ya,Xb,Yb;
            	cin>>Xa>>Ya>>Xb>>Yb; 
            	double AB=sqrt((Xb-Xa)*(Xb-Xa)+(Yb-Ya)*(Yb-Ya)); 
            	cout<<fixed<<setprecision(3)<<AB<<"\n";
            }
            
            • 1
              @ 2024-7-9 13:35:43
              #include<bits/stdc++.h>
              using namespace std;
              int main(){
              	double Xa,Ya,Xb,Yb;//定义 
              	cin>>Xa>>Ya>>Xb>>Yb;//输入A,B坐标 
              	double AB=sqrt((Xb-Xa)*(Xb-Xa)+(Yb-Ya)*(Yb-Ya));//勾股定理 
              	//printf("%.3f",AB); 
              	cout<<fixed<<setprecision(3)<<AB<<"\n";
              } 
              
              
              • 1
                @ 2024-7-8 20:21:05
                #include <bits/stdc++.h>
                using namespace std;
                double xa,xb,ya,yb,x,y;
                int main(){
                	cin>>xa>>ya>>xb>>yb;
                	x=xb-xa;
                	y=yb-ya;
                	long double len=sqrt(x*x+y*y);
                	cout<<fixed<<setprecision(3)<<len<<endl;
                	return 0;
                }
                
                • 1
                  @ 2023-10-3 19:45:10
                  #include <bits/stdc++.h>
                  using namespace std;
                  double xa,xb,ya,yb,m,n;
                  int main(){
                  	cin>>xa>>ya>>xb>>yb;
                  	m=xb-xa;
                  	n=yb-ya;
                  	 double an=sqrt(m*m+n*n);
                  	cout<<fixed<<setprecision(3)<<an<<endl;
                  	return 0;
                  }家人们谁懂不知道用哪个直接用玩呢个头
                  
                  • -1
                    @ 2024-7-9 16:42:30
                    #include <iostream>
                    #include <iomanip>
                    #include <cmath>
                    using namespace std;
                    int main() {
                        double xa,ya,xb,yb,a,b,c,d;
                        cin>>xa>>ya>>xb>>yb;//四个坐标
                        a=xb-xa;//直角边1
                        b=yb-ya;//直角边2
                        c=a*a+b*b;
                        cout << fixed << setprecision(3)<<sqrt(a*a+b*b);//勾股定理
                        return 0;
                    }
                    
                    • 1

                    Information

                    ID
                    519
                    Time
                    1000ms
                    Memory
                    256MiB
                    Difficulty
                    4
                    Tags
                    # Submissions
                    188
                    Accepted
                    89
                    Uploaded By