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. 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 | subhashis_cse | Cpp | 0.00s |

02 | Nazmul0092 | Cpp | 0.00s |

03 | Rana_EEE_DUET | Cpp14 | 0.00s |

04 | emrul | Cpp14 | 0.00s |

05 | bpr10ry | Cpp14 | 0.00s |

06 | gazi93 | Cpp14 | 0.00s |

07 | atqrhmn | Cpp14 | 0.00s |

08 | joy25896 | Cpp14 | 0.00s |

09 | The_Viper | Cpp14 | 0.00s |

10 | Aman_khan | Cpp14 | 0.00s |

11 | maxhasan | Cpp14 | 0.00s |

12 | rayhan50001 | Cpp14 | 0.00s |

13 | non_coder | Cpp14 | 0.00s |

14 | afzalul | Cpp14 | 0.00s |

15 | rezaul_karim | Cpp14 | 0.00s |

16 | Nurul_CSE | Cpp14 | 0.00s |

17 | Indro_BU | Cpp14 | 0.00s |

18 | feodorv | C | 0.00s |

19 | gulzar | Cpp14 | 0.00s |

20 | Mehedi07 | Cpp14 | 0.00s |

21 | jualahmed | Cpp14 | 0.00s |

22 | rafsandevs | Cpp14 | 0.00s |

23 | jayed_al_hasan | Cpp14 | 0.00s |

24 | golapraj | Cpp14 | 0.00s |

25 | MohammadShamim | Cpp14 | 0.00s |

26 | sadia2427 | Cpp14 | 0.00s |

27 | Dragon_162 | Cpp14 | 0.00s |

28 | nazmul_bzs | Cpp14 | 0.00s |

29 | DynamicOvi | Cpp | 0.00s |

30 | mh4746 | Cpp14 | 0.00s |

31 | HM39 | Cpp14 | 0.00s |

32 | Koushik54 | Cpp14 | 0.00s |

33 | lightlessShadO | Cpp14 | 0.00s |

34 | smriad | Cpp14 | 0.00s |

35 | Mahadi024 | Cpp14 | 0.00s |

36 | lolcoder | Cpp14 | 0.00s |

37 | noyonhossen | Cpp14 | 0.00s |

38 | sumaiya710 | C | 0.00s |

39 | Alamgir_1604069 | Cpp14 | 0.00s |

40 | fahim_smm | Cpp14 | 0.00s |

41 | Tajir | Cpp14 | 0.00s |

42 | CSE1604084_Mahir | Cpp14 | 0.00s |

43 | maruf089 | C | 0.00s |

44 | Sudipta_Nath | Cpp14 | 0.00s |

45 | shifat1604112 | Cpp | 0.00s |

46 | 1604131 | Cpp14 | 0.00s |

47 | Nijhum1604125 | Cpp14 | 0.00s |

48 | ashish_pondit | C | 0.00s |

49 | omar1604082 | C | 0.00s |

50 | 1604099_ishtiaq | 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. :(