Блог пользователя padfoot1717

Автор padfoot1717, история, 5 лет назад, По-английски

A few times while solving a problem where we need to compute ceil values, i have encoured WA when i use ceil(var1/double(var2)) type of expression, for example in this problem a submission of mine was failing on just 2 TCs because of using that expression, and soon as i used a different approach for calculating ceil, i got AC. I wanted to know, what is the fundamental issue behind this inaccuracy?

  • Проголосовать: нравится
  • -27
  • Проголосовать: не нравится

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

"I wanted to know, what is the fundamental issue behind this inaccuracy?"

double

The correct way to calculate ceil I use is:

x/y+1-(x%y==0)