Beginner Beginners Problems > Ad-hoc

A grid system is divided in rows and columns. You can consider it like a 2D array or you can consider it like a graph paper. Please check the following picture. ![grid][1] For this problem we will consider the grid is numbered from lower left corner of the grid. For example in the picture above, the lower left point is (0, 0) and the upper right corner is (6, 6). We have a starting point at (2, 1) and a destination point at (6, 6). In a grid system someone can only move in 4 directions – left, right, up and down. In this problem we need to find out what is the minimum number of moves required to go from starting point to destination point for various input set of starting point and destination point. Input: ------ First line of the input will consist of an integer which represent the test case **T (0 < T<= 30)**. Each test case contains 4 non-negative integers X1, Y1 and X2, Y2 separated by a space. Here X1, Y1 denotes the starting point and X2, Y2 denotes the destination point. You can assume all 4 integers will be less than or equal to 100. Output: ------- For each test case first print the test case number as “**Case X: Y**” where **X** is the test case number and Y is an integer denoting the minimum number of moves required to reach the destination from the starting point. Sample Input ------------ 3 2 1 6 6 0 0 9 9 12 6 99 0 Sample Output ------------- Case 1: 9 Case 2: 18 Case 3: 93 [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/3176fdee-3665-c4ac-9d97-08d2e2bb9137_f3ca0db18df946ad872c92333023ee16_W267xH312.png

MD. Jalal Uddin

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 2.00 |

Go | 2.00 |

Java | 2.00 |

JavaScript | 2.00 |

Objective-C | 2.00 |

Perl | 2.00 |

PHP | 2.00 |

Python | 2.00 |

Python3 | 2.00 |

Ruby | 2.00 |

VB.Net | 2.00 |

Solve/Submission

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

01 | Rana_EEE_DUET | Cpp14 | 0.00s |

02 | joy25896 | Cpp14 | 0.00s |

03 | Aman_khan | Cpp14 | 0.00s |

04 | emrul | Cpp14 | 0.00s |

05 | rayhan50001 | Cpp14 | 0.00s |

06 | rafsandevs | Cpp14 | 0.00s |

07 | Indro_BU | Cpp14 | 0.00s |

08 | maxhasan | Cpp14 | 0.00s |

09 | The_Viper | Cpp14 | 0.00s |

10 | gazi93 | Cpp14 | 0.00s |

11 | jayed_al_hasan | Cpp14 | 0.00s |

12 | gulzar | Cpp14 | 0.00s |

13 | rezaul_karim | Cpp14 | 0.00s |

14 | Nurul_CSE | Cpp14 | 0.00s |

15 | sadia2427 | Cpp14 | 0.00s |

16 | SakibAlamin | Cpp14 | 0.00s |

17 | HM39 | Cpp14 | 0.00s |

18 | non_coder | Cpp14 | 0.00s |

19 | nazmul_bzs | Cpp14 | 0.00s |

20 | 1604099_ishtiaq | Cpp14 | 0.00s |

21 | mh4746 | Cpp14 | 0.00s |

22 | Nijhum1604125 | Cpp14 | 0.00s |

23 | MUKTO1604100 | Cpp14 | 0.00s |

24 | Sakif_1604124 | Cpp14 | 0.00s |

25 | Mahadi024 | Cpp14 | 0.00s |

26 | afzalul | Cpp14 | 0.00s |

27 | noyonhossen | Cpp14 | 0.00s |

28 | JAMEE | Cpp14 | 0.00s |

29 | nahid101 | Cpp14 | 0.00s |

30 | 1604131 | Cpp14 | 0.00s |

31 | gourob1604097 | Cpp14 | 0.00s |

32 | 1604110 | Cpp14 | 0.00s |

33 | esha1604103 | Cpp14 | 0.00s |

34 | jualahmed | Cpp14 | 0.00s |

35 | Koushik54 | Cpp14 | 0.00s |

36 | Mehedi07 | Cpp14 | 0.00s |

37 | ayancse_98 | Cpp14 | 0.00s |

38 | atqrhmn | Cpp14 | 0.00s |

39 | Tajir | Cpp14 | 0.00s |

40 | soumitro_cse1604114 | Cpp14 | 0.00s |

41 | lolcoder | Cpp14 | 0.00s |

42 | smriad | Cpp14 | 0.00s |

43 | Biprodas | Cpp14 | 0.00s |

44 | MohammadShamim | Cpp14 | 0.00s |

45 | 1604118 | Cpp14 | 0.00s |

46 | fahim_smm | Cpp14 | 0.00s |

47 | Alamgir_1604069 | Cpp14 | 0.00s |

48 | Nusrat_cse16 | Cpp14 | 0.00s |

49 | skrasel126 | Cpp14 | 0.00s |

50 | Nasif | Cpp14 | 0.00s |

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. :(