EXOCODE6 - Editorial

Problem Link:https://www.codechef.com/problems/EXOCODE6[link text][1]

Author:[https://www.codechef.com/users/vivek96][2]

DIFFICULTY:Easy

PREREQUISITES:Conditional statements and loops,Basic Programming

PROBLEM:Chef School of Witchcraft and Wizardry is known for moulding young minds into the finest wizards and witches. However that comes with a lot of practice. One of the young wizards cast a spell on a spider that makes it leap greater distances.

On observing closely the spider leaped 1 meter in its first leap. 10 meters in its second leap, 19 meters in its third leap , 28 meters in its fourth leap, 37 meters in its fifth leap and so on following a pattern.

In order to capture the spider, the young wizard must be able to tell the number of leaps the spider would take to reach a given distance.

EXPLANATION:It is clear that leap length is increased by 9 in every leap,So Now we have to count the minimum number of leaps required to a cover a distance >=N,so we count minimum no of leaps by using while(true) loop because we dont know the number of iterations exactly required to find minimum no of leaps.

Output must be in format:
Case #1: (answer)

AUTHOR’S AND TESTER’S SOLUTIONS:

#include
![alt text][3]

Edit-problem link updated
[1]: https://www.codechef.com/problems/EXOCODE6
[2]: https://www.codechef.com/users/vivek96
[3]: https://discuss.codechef.com/upfiles/code2_5.png

1 Like