Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Doubt related to floor division

Правка en1, от __hermit__, 2020-12-14 14:00:58

Hi , I have one expression as follows:-

(b*y) — (r)*floor(b*y/r)

b and r are known. We can set any value of y of our choice >=0 .

Now what are the possible value that this expression can take?

By running for some values of r and b, I observed two things:-

if (b%r==0) then the answer is zero (which seems obvious to me) if(b%r!=0) then answer is the following :- g*K where K>=0 and K<= (r/g)-1.

Can someone provide the proof for second case? Also will the answer for following expression be similer? r*ceil(b*y/r)-b*y

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский __hermit__ 2020-12-14 14:00:58 597 Initial revision (published)