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
| Author: | laycurse |
| Date Added: | 29-08-2011 |
| Time Limit: | 3 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

y is 123 not counted in first
@calc_saransh Please read the
The time limit of 3s is total
@cabraconstante This is the
@cabraconstante You can also
why isn't 123 counted in the
@lazzrov Please read the
how many test files in this
@lazzrov - i understand it as
@Admin: Can you double check
@lazzrov Sorry, it should be
@jehad The number of test
@shadow I think the time
@hiroto_adm- Thanks.
@hiroto_adm - I am not able
@cabraconstante Please don't
hiroto_adm @ are u
@armuk_winhsa No. For
@admin giving constraints
@phaniram I think that the
@pdwd It seems to me that
how can i find the deadline
@dineshj92 This contest runs
@admin:I am getting TLE but i
"Now, the box i contains one
@amriteshanand I cannot give
@sankalp91 Please see the
What are specifications of
@sankalp91 http://www.codeche
i am getting Time Limit Error
@sanjivgorka Please don't
how to increase the array
@admin: I have doubt like
Can I read all test in input
modulo 500009 means remainder
do you accept math.h
@darkdiver You can.
@architmittal Yes.
@saayaa The judge use the
thanx.... hiroto_adm....so i