thebigjuicyd's blog

By thebigjuicyd, history, 4 years ago, In English

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 >=?

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 5   Vote: I like it +8 Vote: I do not like it

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.