Codeforces 1257A. Two Rival Students Solution
Solve in C++:
- ///**********ALLAH IS ALMIGHTY************//
- ///AH Tonmoy
- ///Department of CSE
- ///Islamic University,Bangladesh
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- while(t--)
- {
- int n,x,a,b;
- cin>>n>>x>>a>>b;
- int r1,r2;
- r1=x+abs(a-b);
- r2=min(r1,n-1);
- cout<<r2<<endl;
- }
- }
No comments