Box and Ball SystemProblem code: BBSYSTEM |
All submissions for this problem are available.
Chef Ciel has forgotten the combination to the safe. It's a serious incident, because the safe contains this month's waitstaff salaries.
To open the safe, N boxes and N balls are used. The safe has N boxes that numbered from 1 to N uniquely. Each box can contain only one ball. Now, the box i contains one ball that numbered i, and the safe is locked.
The only things which Ciel remember for unlocking the safe are the followings:
- She must put every ball into some box.
- Let the box i contains the ball Ai. When the safe is opened the number of divisors of i equals to the number of divisors of Ai for all i from 1 to N.
How many combinations which satisfy above conditions should she check? The number of combinations can be very large, so you should print this number modulo 500009 (5*105+9).
Input
The first line contains an integer T, the number of test cases. Then T test cases follow. The only line of each test case contains an integer N.
Output
For each test case, print the number of combinations modulo 500009 (5*105+9).
Constraints
1 ≤ T ≤ 100000 (105)
3 ≤ N ≤ 2000000000 (2*109)
Sample Input
3 3 5 100
Sample Output
1 5 43264
Output details
In the first case, the valid combination is
Box: 123 Ball: 132
since the number of divisors of 2 is equal to the number of divisors of 3.
In the second case, the valid combinations are
Box: 12345 12345 12345 12345 12345 Ball: 12543 13245 13542 15243 15342
| Date: | 2011-08-29 |
| Time limit: | 3s |
| Source limit: | 50000B |
| Languages: | All |
Comments
Loading Comments...
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
Loading Submissions...RECENT ACTIVITY FOR THIS PROBLEM:
Loading Recent Activity...HELP
Program should read from standard input and write to standard output.
After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.
