MONONUM - Monotonous numbers

Some integers possess interesting quality: each of their digits is not greater than the digit to the right. Let us define such integers as increasing integers. And let's call integers for which each digit is not lesser than the digit to the right decreasing integers. For example 24558 is increasing, 888410 is decreasing and 5 - is both increasing and decreasing. Given n calculate the ratio of the decreasing n-digit integers to the increasing n-digit integers. We consider only positive integers. Leading zeros are not allowed.

Input

The first line of the input contains number t – the number of tests. Then t test descriptions follow. Each test consists of the single integer n.

Constraints

1 ≤ t ≤ 10000
1 ≤ n ≤ 106

Output

For each test print the needed ratio with six digits in the fractional part.

Example

Input:
2
1
2

Output:
1.000000
1.200000

Added by:Spooky
Date:2009-11-03
Time limit:0.800s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET
Resource:Advancement Autumn 2009, http://sevolymp.uuuq.com/, author: Alexey Shchepin

hide comments
2019-09-04 09:20:23
I used double, no need for BigInt

Last edit: 2019-10-20 18:45:35
2016-04-28 10:28:07 farhad chowdhury
do i require bignum or there is a technique for finding ratio
what will be the number of increasing or decreasing at most for n=1000000
2015-04-17 12:25:51 kamran siddique
Or any thing else there are lot of possiblities

Last edit: 2015-04-17 12:26:40
2013-05-27 14:15:28 Ankit Jhawar
What is the answer for n=1000000?
2012-04-24 15:57:38 Andy
:)

Last edit: 2012-04-30 17:02:09
2011-08-15 12:46:23 YYOrz
It will cause accuracy problems with double?
if n=1000000
answer is 111112.111111 ?


Last edit: 2011-08-15 13:19:09
2010-02-09 18:59:09 alone
@above
yes but one difference...decreasing will contain 10,20..,90 but increasing will not contain 01,02...09
i hope now its clear.. :)
2009-12-21 20:35:09 Jorge Luis Roque Alvarez
for n=2
inc=54
dec=45
inc/dec=1.2

Last edit: 2009-11-05 22:07:34
2009-11-05 11:44:31 যোবায়ের
@krishna, read again, the input is not the number, it is the number of digits you need to consider...[edit: Sorry for my mistake, George is right, I forgot to count the equal ones]

Last edit: 2009-11-06 18:02:23
2009-11-05 11:19:48 krishna kant
How output can be 1.2 for 2 as a input, it should be 1.0. As 2 is increasing ang decreasing both.

Last edit: 2009-11-05 11:21:51
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.