Play with binary
All submissions for this problem are available.
Given an integer N , you have to perform q queries . In each query you need to find out total no. of N bit numbers in binary representation such that there are atmost k 1's in their binary representation . Since the number can be very large you need to output the number modulo 1000000007.
First line consists of atwo space seperated integers N and Q. Next Q lines consists of single integer K.
For each query you need to print the answer.
Should contain all the constraints on the input data that you may have. Format it like:
- 1 ≤ N,Q ≤ 100000
- 0 ≤ K ≤ 100000
Input: 5 2 2 4 Output: 16 31
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions