8 条题解
-
2
#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; }
-
1
-
0
#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; }
- 1
信息
- ID
- 834
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- (无)
- 递交数
- 670
- 已通过
- 312
- 上传者