Lucian_Adrian

Untitled

Aug 22nd, 2021
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,k;
  6. int p;
  7. cin >> k >> n;
  8. p = k / n;
  9. if (k-p*n > n*(p+1)-k)
  10. cout << n*(p+1);
  11. else
  12. cout << p*n;
  13. return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment