-->
当前位置:首页 > 题库

PROGRAMMING:Lost bear_ two

Luz5年前 (2021-05-10)题库383
$$Bear_ 2 $$to go to Qingqing grassland as a guest, the road from him to Qingqing grassland is a straight line with a total of $$n $$dots ($$1 $$means $$bear)_ The starting position of $$2, $$n $$indicates the position of Qingqing grassland). But he is simple and lazy, so he takes a rest every time he goes to a place, and then decides to take a few steps to rest.
Suppose he chooses a number $$h $$from $$1 $$to $$k $$every time, and then moves forward $$h $.
Note that if $$bear_ Over the green grassland, it will never reach.
For example, if it decides to go two steps forward at the position of $$n-1 $$to reach $$n + 1 $, then it will continue to go on and never reach it.
Now it is required to take a rest from point $$1 $$to point $$n $$(to reach the goal of taking a rest in Qingqing grassland).
###Input format:
The first line gives an integer, $$t (1 < = T < = 10) $, indicating the number of sample groups
After the $$t $$line, each line gives $$2 $$positive integers $$n, K (1 < n, K < = 1000) $.
###Output format:
For each group of data, output the expected number of breaks to Qingqing grassland in one line, and reserve $$3 $$decimal places
###Input example:
Here is a set of inputs. For example:
```in
three
7 6
7 9
10 1
```
###Output example:
The corresponding output is given here. For example:
```out
zero point six one eight
zero point two eight two
nine
```
###Tips:
20% data, $$1 < = n, K < = 10$$
60% data, $$1 < = n, K < = 100$$
For 100% data, $$1 < = n, K < = 1000 $$< br > < br > < br > < br > < br > is used


answer:If there is no answer, please comment