All submissions for this problem are available.
N lizards are standing in a line, each of them is either facing left or right with equal probability. A pair of indices (i,j) (iafraid pair if lizard at index i is facing right, and lizard at index j is facing left.
What is the expected number of afraid pairs?
The first line of the input contains an integer T denoting the number of test cases. For each case there is a single line containing N, the number of lizards.
For each test case, output a single line containing the expected number of lizards as an irreducible fraction. See the sample output for the exact format.
- T = 1000
- 1 <= N <= 10^9
Input: 2 2 3 Output: 1/4 3/4
Example case 1. There are four possible ways: LL, LR, RR, RL. Of these only 1 has an afraid pair.
|Time Limit:||1 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, CLOJ, FS|
Fetching successful submissions