Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sic Mundus Creatus Est Its dark and raining, and Jojo is visiting a small town in Germany to help the local police solving a mysterious

Sic Mundus Creatus Est

Its dark and raining, and Jojo is visiting a small town in Germany to help the local police solving a mysterious case of missing children near a cave. To help his investigation, Jojo decided to use a time machine. Using the time machine Jojo travelled to N different years, and now Jojo wants to know the smallest difference between two different years he has visited. Help Jojo to answer this question!

Format Input

The first line contains a single number T, the number of testcases. Each testcase contains a number N, which is the number of years Jojo has visited. The next N lines contain Ai which is the i-th year Jojo has visited using the time machine.

Format Output

For each testcase, output one line starting with Case # X: (without quotes) where X is the testcase number (starting from 1) followed by the smallest difference between two different years Jojo has visited.

Constraints

1 T 100 2 N 100 1 Ai 1000000 All values of Ai in a testcase are different

Sample input 1 (standard input) 2 3 2019 1986 1953 7 1945 2020 2055 1919 2013 1975 2000

Sample Output 1 (standard output) Case #1: 33 Case #2: 7

Explanation On the first testcase, this is the difference between every pair of years Jojo has visited: The difference of 1953 and 1986 is 33 years. The difference of 1953 and 2019 is 66 years. The difference of 1986 and 2019 is 33 years.

The smallest difference is 33 years, which is between 1953 and 1986, or between 1986 and 2019.

On the second testcase, the smallest difference is 7 years which is between 2013 and 2020.

DO IN C Please

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago