Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- int n, x, k;
- cin>>n>>x>>k;
- n -= x;
- n %= k;
- x %= k;
- cout<<max(n, x) - min(n, x)<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment