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

Автор AmberFrame, 7 лет назад, По-английски

Here's another method. Let's assume the maximum digit of number x is p.For example, the maximum digit of 260d7 is d(13).

If the binary form of number x contains 2^p ,then x will get a decrease after those steps.Otherwise,it not.

Now you see that only p matters the result.We can enumerate the p and form a dp[i][0/1][0/1], which means IN THE FIRST i DIGITS,whether x<L or x=L and whether the p has appeared in x.We can enumerate the next digit to transfer it.If the current digit we enumerate contains 2^p,we just simply discuss about it.

Time Complexity:O(T*16*16*2*2*16)

Code:24938218

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

»
7 лет назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

Auto comment: topic has been updated by AmberFrame (previous revision, new revision, compare).

»
7 лет назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

D

»
7 лет назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

Well I think it's a great method(though may be too hard for me because of my poor English:D)