Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits\stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- scanf("%d", &t);
- while(t--)
- {
- long long a, b, c;
- scanf("%lld %lld %lld", &a, &b, &c);
- int n = 2*abs(a-b) ;
- if(a > n || b > n || c > n) printf("-1\n");
- else
- {
- c += n/2;
- while(c > n) c -= n;
- printf("%lld\n", c);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement