[Solution] Ranklist Pages CodeChef Solution
Problem
Chef participated in a contest and got a rank .
Chef is trying to find his name in the ranklist but there are too many pages.
Each page consists of participants. Chef wants to find the exact page number which contains his name.
Help Chef find the page number.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of a single integer - denoting the rank of Chef.
Output Format
For each test case, output the page number of the ranklist containing Chef's name.
Explanation:
Test case : Since each page has participants, the first page has participants with rank to . Thus, Chef can find his name in page number .
Test case : Since each page has participants, the first page has participants with rank to and the second page has participants with rank to . Thus, Chef can find his name in page number .
Test case : Chef will find his name in page number . The sixth page consists of participants with ranks to .
Test case : Chef will find his name in page number . The third page consists of participants with ranks to .
No comments:
Post a Comment