How I Met Your Mother solution codechef
On Valentine’s day, Ted was telling his kids the story of “How I met your mother”. The story goes likes this –
Once upon a time in a far land, I decided to give Robin a blue french horn as a symbol of my eternal love for her but your uncle Barney was the main obstacle in my love story.
My house was present at, Robin’s house was at and Barney’s house was at (All houses are present on X-axis). Barney has arranged lasers around his house in a circle of a certain radius , i.e. from , there are lasers at a on both sides so that he can save his best bro from being committed in a relationship.
It took me so many days to figure out how to cross the lasers. I want you kids to know how much I struggled. So tell me how much distance I will walk without struggling in the laser.
Input How I Met Your Mother solution codechef
First-line contains the total number of test cases. Then the test cases follow.
- The only line of each test case contains 4 integers –
- : Ted’s home coordinate,
- : Robin’s home coordinate,
- : Barney’s home coordinate, and
- : radius of the lasers
Output How I Met Your Mother solution codechef
For each test case, print one integer – the distance for which Ted will not struggle with lasers.
Constraints How I Met Your Mother solution codechef
Example Input How I Met Your Mother solution codechef
-1 2 -2 2
6 1 1 4
-3 -6 -5 2
In the first test case,, , and . So the path with lasers will be from to . Path without lasers => to (2 units).
Codechef is an platform built to programmers compete against others in the community and to improve their knowledge by facing various challenges. Challenges are categorised on the basis of their difficulty level , if your rating is above 2000 you are in top tier i.e, Division 3 and if your rating is between 2000 and 1600 you will be in tier 2 i.e, Division 3 and if your rating is below that you will be in lowest tier i.e, Division 3. You can improve your rating by successful submission with minimum penalty.
- Cheems VS Doge solution codechef
- Game of Primes solution codechef
- Books and Friends solution codechef
- Run It Back solution codechef
- Buy Masks solution codechef
Also Read : Neenade Naa song lyrics with English Translation