Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
EQU2 - Yet Another Equation |
Consider the equation
x2 - ny2 = 1
where n is some integer.
Find the smallest strictly positive integer solutions (x, y) for a given n.
Input
The number of test cases t (around 30), followed by a list of t values of n (2 ≤ n ≤ 1000). You can assume that the equation can be solved for all values of n in the input set.
Output
For every test case, the values of x and y separated by a space character, on separate lines.
Example
Input: 3 2 6 61 Output: 3 2 5 2 1766319049 226153980
Adicionado por: | Mauro Persano |
Data: | 2007-08-18 |
Tempo limite: | 4.739s |
Tamanho do fonte: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP JS-RHINO NODEJS PERL6 PY_NBC SCALA TCL VB.NET |
Origem: | Brahmagupta, circa 628 AD |