aditya1703's blog

By aditya1703, history, 5 hours ago, In English

Hello Everyone. I am stuck on the following problem -

Given a natural number, n. Determine how many ways there are to represent the number n as a sum of powers of two. Partitions that differ in the order of terms are considered the same. For example, for the number 3, there are two partitions — 2 + 1 and 1 + 1 + 1, and for the number 5, there are four partitions — 4 + 1, 2 + 2 + 1, 2 + 1 + 1 + 1, 1 + 1 + 1 + 1 + 1.

This is the solution. Can anybody help me understand it?

There was also an explanation provided- Let's denote fi — the number of ways the number i is a sum of powers of 2, f0=1. Let's consider two cases — when i is odd and when i is even.

For the case of odd i, one can notice that in all partitions of this number one of the terms will be equal to 1, so the number of partitions of the number i in this case is equal to the number of partitions of the number i−1. Thus, fi=fi−1 for odd i.

For the even case i, one can notice that all partitions can be divided into two parts — partitions in which all terms are even and partitions in which at least one term equals 1. Thus fi=fi−1+fi/2.

The asymptotic behavior of the described solution is O(n).

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By aditya1703, history, 11 months ago, In English

Given a string Str, rearrange Str such that the resultant string T maximizes min (LCS(Str, T) and LCS(Str, reverse(T))).

Full text and comments »

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

By aditya1703, history, 17 months ago, In English

The ratio of registered candidates and those making at least one submission is bad. Only 9249 out of 21518 will be rated; this leads to either a very small increase in the rating of players rated below 1400. I think it's because of the increasing difficulty of 1st questions in the contest(which is a good thing, I think), so if the system rated everybody who registered, it would be much fairer for those who actually submitted; some OJs do this already.

Codeforces Round #853 (Div. 2) out of 24262, 7432 candidates will be rated.

Educational Codeforces Round 143 (Rated for Div. 2) out of 27849, 13755 candidates will be rated.

Codeforces Round #852 (Div. 2) out of 25361, 9339 candidates will be rated.

These are the stats of the last 4 rated contests; 1st one is in the paragraph, do comment on your thoughts about this.

Full text and comments »

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