All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Lira loves Linear Algebra and she is especially keen about matrix :).
Today, she learnt some properties about matrices, namely, she learnt about what the trace of a matrix is, as her teacher gave her many exercises for her to practice.
As we know she is pretty clever, she rapidly came up with some definitions of her own and devised a somewhat harder version of the problem initially proposed by her teacher.
Namely, she defines a Positive Invertible Integer Matrix as being an invertible 2x2 matrix composed only of positive (i.e. greater than 0) integer elements and whose determinant is greater than 0.
Now, she is interested in counting how many such matrices are there, such that their trace is equal to N .
It's your turn to solve Lira's problem :D
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
Each test case consist of single integer N, the trace of the matrix.
For each test case, output a single line containing the number of Positive Invertible Integer Matrices such that their trace is equal to N and determinant is positive.
Read here for additional info:
- 1 ≤ T ≤ 50
- 3 ≤ N ≤ 2500
Input: 1 3 Output: 2
The only two matrices that exist with trace equal to 3 and that satisfy all the given conditions are:
|Tags||april14, easy-medium, kuruma, maths|
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.