Problem:- The chef is eagerly waiting for a piece of information. His secret agent told him that this information would be revealed to him after K weeks.
- X days have already passed and Chef is getting restless now. Find the number of remaining days the Chef has to wait, to get the information.
- It is guaranteed that the information has not been revealed to the Chef yet.
Input Format:- The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
- Each test case's first and only line contains two space-separated integers K and X, as described in the problem statement.
Output Format:- For each test case, output the number of remaining days that the Chef will have to wait for.
Constraints:- 1 ≤ T ≤ 500
- 1 ≤ K ≤ 10
- 1 ≤ X < 7⋅K
Sample input:
4
1 5
1 6
1 1
1 2
Sample Output:- Test case 1: The information will be revealed to the Chef after 1 week, which is equivalent to 7 days. Chef has already waited for 5 days, so he needs to wait for 2 more days in order to get the information.
- Test case 2: The information will be revealed to the Chef after 1 week, which is equivalent to 7 days. Chef has already waited for 6 days, so he needs to wait for 1 more day in order to get the information.
- Test case 3: The information will be revealed to the Chef after 1 week, which is equivalent to 7 days. Chef has already waited for 1 day, so he needs to wait for 6 more days in order to get the information.
- Test case 4: The information will be revealed to the Chef after 1 week, which is equivalent to 7 days. Chef has already waited for 2 days, so he needs to wait for 5 more days in order to get the information.
Solution:
for _ in range(int(input())):
k, x = list(map(int,input().split()))
print(k*7 - x)
Note: The problem statement is given by codechef.com but the solution is generated by the Geek4Tutorial admin. We highly recommend you solve this on your own, however, you can refer to this in case of help. If there is any concern regarding this post or website, please contact us using the contact form. Thank you!
No comments:
Post a Comment