StoneHaos

Untitled

Mar 22nd, 2020
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int func(int a, int b) {
  4.     int res = a / b, mod = a % b;
  5.     if (b % 2 == 0 && mod >= b / 2)
  6.         ++ res;
  7.     else if (b % 2 != 0 && mod > b / 2)
  8.         ++ res;
  9.     return res;
  10. }
  11.  
  12. int main(void) {
  13.     int a, b, c;
  14.     scanf("%d%d", &a, &b);
  15.     printf("%d\n", func(a, b));
  16. }
RAW Paste Data