Advertisement
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 fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
- #define pi pair<int , int>
- #define mp make_pair
- #define f first
- #define s second
- int main()
- {
- fast();
- ll t;
- cin>>t;
- while(t--)
- {
- ll x,y,n,z;
- cin>>x>>y>>n;
- z=n/x;
- while(1)
- {
- if(x*z+y<=n)break;
- else
- z--;
- }
- cout<<x*z+y<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement