GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 11 May 2022

[Solution] Circular Track CodeChef Solution | CodeChef Problem Solution 2022

There is a circular track of length M consisting of M checkpoints and M bidirectional roads such that each road has a length of 1 unit.

Chef is currently at checkpoint A and wants to reach checkpoint B. Find the minimum length of the road he needs to travel.

Solution Click Below:-  CLICK HERE

Input Format

  • First line will contain T, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, three integers A,B, and M - the initial checkpoint, the final checkpoint, and the total number of checkpoints respectively.

Output Format

For each test case, output the minimum length Chef needs to travel.

Constraints

  • 1T1000
  • 2M109
  • 1A,BM
  • AB

Join Now for Solution:- 

No comments:

Post a Comment