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

Автор thebigjuicyd, история, 4 года назад, По-английски

Recently, I was looking at the solution to 1217A - Creating a Character. In the first few lines of the the solution, the author writes how 2addS > exp + int-str. In the next line, the author writes 2addS >= exp + int-str + 1. If there like a rule that says if you add one to one side, you can get a >=?

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

»
4 года назад, # |
Rev. 5   Проголосовать: нравится +8 Проголосовать: не нравится

If all the numbers are integer and you add one to the smaller side of the inequation you have to replace > with >=. It is really easy to prove this. x and y are integers, x > y ->the difference between x and y is at least one. So when we add one to y it means that if y was equal to x — 1 now it is equal to x otherwise y is smaller than x.x >= y + 1.