407389: GYM102783 B Heading Home

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Heading Hometime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Abhinav is far away from his home on Halloween night! He's incredible scared of being attacked by ghosts, so he wants to run home as quick as he can to maximize his chance of making it through the night safely.

We can model Abhinav's position and his home's position as points on a number line as $$$a$$$ and $$$h$$$, respectively. In a single second, Abhinav can move anywhere between $$$1$$$ and $$$d$$$ units. Given $$$a$$$, $$$h$$$, and $$$d$$$, can you figure out how fast Abhinav can make it back home?

Input

The first line will consist of a single integer $$$T$$$ ($$$1 \leq T \leq 1000$$$) consisting of the number of test cases you will need to process. The next $$$T$$$ lines each consist of a single test case with $$$3$$$ space separated integers $$$a$$$, $$$h$$$, $$$d$$$ ($$$1 \leq a, h, d \leq 10^5$$$), which represent Abhinav's position, his home's position, and his max speed.

Output

For each test case, output a single integer giving the minimum amount of time (in seconds) it will take Abhinav to reach his home.

ExampleInput
3
1 5 1
1 5 2
1 5 3
Output
4
2
2

加入题单

算法标签: