7 条题解

  • 2
    @ 2023-6-14 19:09:50
    #include <iostream>
    #include <stdio.h>
    #include <iomanip>
    #include <math.h>
    using namespace std;
    const int N = 1e6 + 10;
    const int INF = 0x3f3f3f3f;
    int main()
    {
    	int x1 , y1 , x2 , y2 , jl1 , jl2 , j;
    	cin >> x1 >> y1 >> x2 >> y2;
    	jl1 = fabs( x1 - x2 ); 
    	jl2 = fabs( y1 - y2 );
    	j = jl1 + jl2;
    	cout << j;
    	return 0;
    }
    
    • 2
      @ 2022-10-30 16:50:32
      #include <bits/stdc++.h>
      
      using namespace std;
      
      int main(void)
      {
          int x1, y1;
          int x2, y2;
      
          int i, j;
      
          cin >> x1 >> y1 >> x2 >> y2;
      
          i = abs(x1 - x2);
          j = abs(y1 - y2);
      
          cout << i + j;
      
          return 0;
      }
      
      • 1
        @ 2024-11-23 22:14:22
        #include<iostream>
        #include<iomanip>
        #include<cmath>
        using namespace std;
        int main()
        {
        	int x1,y1,x2,y2;
        	cin>>x1>>y1>>x2>>y2;
        	cout<<abs(x1-x2)+abs(y1-y2);
        	return 0;
        }
        
        • 1
          @ 2024-3-29 19:51:49

          **#include<iostream> using namespace std; int main() { int xx,yy,x,y; cin >> x >> y >> xx >> yy; int sum = fabs(xx - x) + fabs(yy - y); cout << sum << endl; return 0; } **

          • 1
            @ 2023-3-12 16:03:53

            #include <iostream> #include <stdio.h> #include <string.h> #include <queue> #include <math.h> #include <vector> #include <algorithm> #include <iomanip> #include <stack> #include <bits/stdc++.h> using namespace std; int main(void){ int x1,y1; int x2,y2;

            cin>> x1>>y1>>x2>>y2;
            int i,j;
            i=abs(x1-x2);
            j=abs(y1-y2);
            cout << i+j;
            return 0;
            

            }

            • 0
              @ 2022-8-13 18:46:18
              #include <iostream>
              #include <cstdio>
              #include <cstring>
              #include <string>
              #include <iomanip>
              // #include <cmath>
              using namespace std;
              #define long long LL
              const int N = 1e6+6;
              const int INF = 0x3f3f3f3f;
              int x1,y1,x2,y2;
              int ans(int x){
                  if (x > 0) return x;
                  else return 0 - x;
              }
              int manhaton(int a1,int b1,int a2,int b2){
                  return ans(a1 - a2) + ans(b1 - b2);
              }
              int main(){
                  cin >> x1 >> y1 >> x2 >> y2;
                  cout << manhaton(x1,y1,x2,y2);
                  return 0;
              }
              
            • -3
              @ 2022-2-8 19:31:18

              #include <stdio.h> #include <iostream> #include <math.h> using namespace std; int main() { int x1 , y1 , x2 , y2; cin>> x1 >> y1 >> x2 >> y2; int a , b , a1 , b1 , d; a = x1 - x2 ; b = y1 - y2 ; a1 = fabs(a); b1 = fabs(b); d = a1 + b1; cout << d ;

              }

              • 1

              信息

              ID
              834
              时间
              1000ms
              内存
              128MiB
              难度
              4
              标签
              (无)
              递交数
              650
              已通过
              306
              上传者