Advertisement
KawaiiChen

Untitled

Nov 30th, 2020
1,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1.  
  2. def solution():
  3.     N, S = map(int, input().split(" "))
  4.  
  5.     # предварительный результат
  6.     result = N / S
  7.     # int() переводит в целое число, отбрасывая дробную часть
  8.     if result - int(result) >= 0.5:
  9.         # если разница между числом с дробной частью и без неё больше или равен 0.5, то округляем вверх
  10.         result = int(result) + 1
  11.     else:
  12.         # иначе вниз
  13.         result = int(result)
  14.     print(result)
  15.  
  16. solution()
  17.  
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement