304 North Cardinal St.
Dorchester Center, MA 02124

# Waiting Time CodeChef Solution

## Problem – Waiting Time CodeChef Solution

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 Chef has to wait for, 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.
• The first and only line of each test case 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 Chef will have to wait for.

#### Constraints

• 1 \leq T \leq 5001≤T≤500
• 1 \leq K \leq 101≤K≤10
• 1 \leq X \lt 7\cdot K1≤X<7⋅K

#### Sample 1:

Input: 4
1 5
1 6
1 1
1 2
Output: 2
1
6
5

#### Explanation:

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.

### Waiting Time CodeChef Solution in Python3

for _ in range(int(input())):
k,x = map(int,input().split())
print(k*7-x)

### Waiting Time CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
int t;
cin>>t;
while(t--){
int k,x,y;
cin>>k>>x;
y=7*k-x;
cout<<y<<endl;
}
return 0;
}


### Waiting Time CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t!=0){
int k = s.nextInt();
int x = s.nextInt();
System.out.println(k*7 - x);
t = t -1;
}
}
}

##### Waiting Time CodeChef Solution Review:

In our experience, we suggest you solve this Waiting Time CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Waiting Time CodeChef Solution

Find on CodeChef

##### Conclusion:

I hope this Waiting Time CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions