1 条题解
-
1
/** * author: 小飞侠cy * created: 2025.06.12 15:02:49 */ #include <bits/stdc++.h> using namespace std; #define ls u << 1 #define rs u << 1 | 1 #define LL long long //#define int long long #define PII pair <int, int> #define fi first #define se second #define pub push_back #define pob pop_back #define puf push_front #define pof pop_front #define lb lower_bound #define ub upper_bound #define i128 __int128 #define pcnt(x) __builtin_popcount(x) #define mem(a,goal) memset(a, (goal), sizeof(a)) #define rep(x,start,end) for(int x = (start) - ((start) > (end)); x != (end) - ((start) > (end)); ((start) < (end) ? x ++ : x --)) #define aLL(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() const int INF = 998244353; const int mod = 1e9 + 7; const int N = 100010; void solve() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); int dx = abs(c - a); int dy = abs(d - b); if(dx == 0 && dy == 0) { cout << 0 << '\n'; return ; } if(dy == 0) { if(dx <= 2) cout << 2 << '\n'; else cout << (dx + 1) / 2 << '\n'; return ; } int c1 = (dx + 1) / 2; int c2 = (dy + 1) / 2; cout << max(c1, c2) << '\n'; } signed main() { int t = 1; cin >> t; while (t --) solve(); return 0; }
信息
- ID
- 5608
- 时间
- 3000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- (无)
- 递交数
- 4
- 已通过
- 1
- 上传者