You are not logged in. Please login at www.codechef.com to post your questions!

×

# Natural number k satisfying k & x = k

 0 How do I find all natural numbers k satisfying k & x == k for some Natural Number x? asked 16 Jan, 17:03 2★rds_98 45●6 accept rate: 9% SOS dp. Read the codeforces article. (16 Jan, 18:15)

 3 You can just go through the sub-optimal solution mentioned here: http://codeforces.com/blog/entry/45223 answered 16 Jan, 18:20 2.4k●4●20 accept rate: 17%
 1 you can convert the number x into binary form i.e 15=1+2+4+8 and 13=1+4+8 and make array of all these numbers i.e array for 15={1,2,4,8} and array for 13 will be {1,4,8} and the find the subsets of this array... and just add elements of each of them.. so 15 will update all elements from 1 to 15 as all numbers can be computed using elements of that array.. EDIT: well, there may be another optimised soln about which i am not aware answered 16 Jan, 23:47 1.3k●1●9 accept rate: 26%
 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "title")
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×226
×182
×94
×37
×3

question asked: 16 Jan, 17:03

question was seen: 432 times

last updated: 16 Jan, 23:49