Promi_38

cf 1374A

Jan 17th, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int t;
  6.     scanf("%d", &t);
  7.    
  8.     while(t--)
  9.     {
  10.         long long x, y, n;
  11.         scanf("%lld %lld %lld", &x, &y, &n);
  12.        
  13.         if(n - (n % x) + y <= n) printf("%lld\n", n - (n % x) + y);
  14.         else printf("%lld\n", n - (n % x) + y - x);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment