Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

electro177's blog

By electro177, history, 2 months ago, In English

A big binary number

You are given a number n. Find the decimal value of the number that is formed by concatenating the binary representations of the first n positive

Integers. Print the answer modulo 10^9 +7.

Example

Consider N = 2:

The binary representation of 1 is 1.

• The binary representation of 2 is 10

. So the number form after concatenation is 110. in decimals this is equivalent to 6.

n<1e9;

Some help what to do

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

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

[Deleted]

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Same problem has been discussed here.