I love problems with short descriptions. I believe you love them too. Let's go for it. Given two recursive functions - **f(n) = f(n - 1) + g(n - 2)**, if n > 1 **g(n) = g(n - 1) + f(n - 2)**, if n > 1 Here, **f(0) = a1**, **f(1) = b1**, **g(0) = a2**, **g(1) = b2** Let's define **d(n) = |f(n) - g(n)|**, ( absolute difference of f(n) and g(n) ) If these functions continue infinitely, find the **maximum** value of **d(n)**. Input: ------ Input starts with an integer **T (T <= 100)**, denoting the number of test cases. Each case contains four integer **a1**, **b1**, **a2**, **b2** which are already described. Here, **1 <= a1, b1, a2, b2 <= 1,000,000** Output: ------- For each test case print the case number and the maximum value of **d(n)**. Sample Input ------------ 2 12 33 45 21 32 23 67 90 Sample Output ------------- Case 1: 45 Case 2: 67

Feroz Ahmmed

Language |
Time Limit (seconds) |

C | 2.00 |

C++ | 2.00 |

C++14 | 2.00 |

C# | 3.00 |

Go | 3.00 |

Java | 3.00 |

JavaScript | 3.00 |

Objective-C | 3.00 |

Perl | 3.00 |

PHP | 3.00 |

Python | 3.00 |

Python3 | 3.00 |

Ruby | 3.00 |

VB.Net | 3.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | anowar1112 | Cpp14 | 0.00s |

02 | nasif2587 | Cpp14 | 0.00s |

03 | MAHRahat | Cpp14 | 0.00s |

04 | PKP_007 | Cpp14 | 0.00s |

05 | murad_al_wajed | Cpp14 | 0.00s |

06 | imunir | Cpp14 | 0.00s |

07 | Tanmoy_Datta | Cpp14 | 0.00s |

08 | KIRIN_36 | Cpp14 | 0.00s |

09 | sayedgkm | Cpp14 | 0.00s |

10 | n_orbit | Cpp14 | 0.00s |

11 | skmonir | Cpp14 | 0.00s |

12 | mhiceiuk | Cpp | 0.00s |

13 | Jisancse | Cpp14 | 0.00s |

14 | Mr_adnan | Cpp14 | 0.00s |

15 | Masum_ice | Cpp14 | 0.00s |

16 | rafy | Cpp14 | 0.00s |

17 | Tahmid | Cpp14 | 0.00s |

18 | adamantium | Cpp14 | 0.00s |

19 | fearless_hasan | Cpp14 | 0.00s |

20 | rayhan50001 | Cpp14 | 0.00s |

21 | pulak_ict_mbstu | Cpp14 | 0.00s |

22 | hiddenhopes | Cpp14 | 0.00s |

23 | SKL12 | Cpp14 | 0.00s |

24 | feodorv | Cpp14 | 0.00s |

25 | anik_JU | Cpp14 | 0.00s |

26 | Dariwala | Cpp14 | 0.00s |

27 | prdx9_abir | Cpp14 | 0.00s |

28 | sazal_dev | Cpp14 | 0.00s |

29 | Morass | Cpp14 | 0.00s |

30 | froghramar | Cpp14 | 0.01s |

31 | asma_chy | Cpp14 | 0.01s |

32 | seyedssz | Cpp14 | 0.01s |

33 | limlim | Cpp14 | 0.01s |

34 | ammasum | Cpp14 | 0.01s |

35 | Reayz | Cpp14 | 0.01s |

36 | moshiur_cse15 | Cpp14 | 0.01s |

37 | Dragon_Curve | Cpp14 | 0.01s |

38 | nmunim | Cpp14 | 0.01s |

39 | Knight_King | Cpp14 | 0.01s |

40 | emrul | Cpp14 | 0.01s |

41 | tariqiitju | Cpp14 | 0.01s |

42 | ehsan_sshuvo | Cpp14 | 0.01s |

43 | shaft | Cpp14 | 0.01s |

44 | MazedRupok | Cpp14 | 0.01s |

45 | fsshakkhor | Cpp14 | 0.01s |

46 | ssavi | Cpp14 | 0.01s |

47 | Puja1409 | Cpp14 | 0.01s |

48 | akazad_cse13_ruet | Cpp14 | 0.01s |

49 | alhelal_cse | Cpp14 | 0.01s |

50 | INUA | Cpp14 | 0.01s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(