Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n, x , a, b, t;
- int main()
- {
- cin >> t;
- for(int i = 0; i< t ; i++)
- {
- cin >> n >> x >> a >> b;
- cout << abs(a-b) + min(n-1-abs(a-b), x) << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement