Advertisement
jakaria_hossain

codeforces - required reminder

Jun 28th, 2020
1,627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  6. #define pi pair<int , int>
  7. #define mp make_pair
  8. #define f first
  9. #define s second
  10.  
  11. int main()
  12. {
  13.     fast();
  14.     ll t;
  15.     cin>>t;
  16.     while(t--)
  17.     {
  18.         ll x,y,n,z;
  19.         cin>>x>>y>>n;
  20.         z=n/x;
  21.         while(1)
  22.         {
  23.             if(x*z+y<=n)break;
  24.             else
  25.                 z--;
  26.         }
  27.         cout<<x*z+y<<endl;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement