Chessboard Distance Solution
Codechef February Lunchtime 2022
Problem Code : CHESSDIST
Solution :
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;
void solve()
{
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
ll d = max(abs(x1 - x2), abs(y1 - y2));
cout << d << "\n";
}
int main()
{
ll t;
cin >> t;
while (t--)
{
solve();
}
}
Comments
Post a Comment