VECTAR5 - Count Subsets
You are given a set S = {1, 2, 3, ..., n}. Your task is simple. You have to calculate the number of ways of selecting non empty subsets A and B such that A is not a subset of B and B is not a subset of A. Since answer can be large output the result mod 10^9 + 7.
Input
First line of input contains single integer t denoting number of test cases.
Next t lines contain a single integer n.
Output
For each test case output answer to problem by taking mod with 10^9 + 7.
Constraints
1 <= t <= 100000
1 <= n <= 1000000
Example
SAMPLE INPUT: 2 4 8 SAMPLE OUTPUT: 110 52670
hide comments
aqua_regia:
2016-06-23 12:04:14
I see it, problem with modular subtraction. What should be done instead?
|
|
aqua_regia:
2016-06-22 23:03:00
@Francky: okey then this is the link to forum. http://discuss.spoj.com/t/wa-in-count-subsets-vectar5/15298
|
|
aqua_regia:
2016-06-22 20:29:25
@Piyush: My programs gives correct output for test cases and other manual test cases. Can you please check my submission and give some test cases where it fails. My ideone submission is http://ideone.com/**********
|
|
Bhuvnesh Jain:
2016-06-22 16:13:56
Are the given sample test cases correct? I think the answer for n = 4 should be 100 instead of 110.
|
|
Siddharth Singh:
2016-06-21 12:43:41
As Soon As I Saw The Inputs I Knew I Had Solved This One ;)
|
|
Francky:
2016-06-21 10:13:56
In input file, last line isn't feed with "\n".
|
|
meettaraviya:
2016-06-21 00:46:18
time limit too strict, even the fastest algo possible does not work
|
Added by: | Piyush Kumar |
Date: | 2016-06-20 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |