Saleh127

cf 1374A

Jun 28th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. test
  10. {
  11.  
  12. ll a,c,d,e,f,i,j,k,l;
  13. cin>>a>>c>>d;
  14. e=d%a;
  15. if(e==c) cout<<d<<endl;
  16. else if(e<c)
  17. {
  18. f=d-e-a+c;
  19. cout<<f<<endl;
  20. }
  21. else
  22. {
  23. f=d-(e-c);
  24. cout<<f<<endl;
  25. }
  26. }
  27.  
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment