【学习笔记】关于正整数除法下取整和上取整的一些基本运算公式
生活随笔
收集整理的這篇文章主要介紹了
【学习笔记】关于正整数除法下取整和上取整的一些基本运算公式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
您從來沒有見過這么菜的東西對不對。沒錯我就是這么菜。實在對不起玷污了您的眼睛。
OI 中經常遇到有關下取整和上取整的運算,這些公式手推很容易,但是對我這種菜雞來說非常容易出錯并且需要耗時,因此不如把他們記住。
設 \(a,b,m\) 為正整數:
\[\lfloor\frac{a}{b}\rfloor=\lceil\frac{a+1}{b}\rceil-1,\lceil\frac{a}{b}\rceil=\lfloor\frac{a-1}{b}\rfloor+1 \]\[ab\ge m\Leftrightarrow a\ge\lceil\frac{m}{b}\rceil\Leftrightarrow b\ge\lceil\frac{m}{a}\rceil \]\[ab\gt m\Leftrightarrow a\gt\lfloor\frac{m}{b}\rfloor\Leftrightarrow b\gt\lfloor\frac{m}{a}\rfloor \]\[ab\le m\Leftrightarrow a\le\lfloor\frac{m}{b}\rfloor\Leftrightarrow b\le\lfloor\frac{m}{a}\rfloor \]\[ab\lt m\Leftrightarrow a\lt\lceil\frac{m}{b}\rceil\Leftrightarrow b\lt\lceil\frac{m}{a}\rceil \]總結
以上是生活随笔為你收集整理的【学习笔记】关于正整数除法下取整和上取整的一些基本运算公式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Codeforces 1338 题解
- 下一篇: Codeforces 1329 题解