Chef in his Office CodeChef Solution

Problem – Chef in his Office CodeChef Solution

Recently Chef joined a new company. In this company, the employees have to work for X hours each day from Monday to Thursday. Also, in this company, Friday is called Chill Day — employees only have to work for Y hours (Y<X) on Friday. Saturdays and Sundays are holidays.

Determine the total number of working hours in one week.

Input Format

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers X and Y — the number of working hours on each day from Monday to Thursday and the number of working hours on Friday respectively.

Output Format

For each test case, output the total number of working hours in one week.

Constraints

  • 1≤T≤100
  • 2≤X≤12
  • 1≤Y<X

Sample 1:

Input: 3
10 5
12 2
8 7
Output: 45
50
39

Explanation:

Test case 1: The total number of working hours in a week are: 10(Monday)+10(Tuesday)+10(Wednesday) +10(Thursday) +5(Friday) =45

Test Case 2: The total number of working hours in a week are: 12(Monday)+12(Tuesday)+12(Wednesday)+12(Thursday)+2(Friday)=50

Test Case 3: The total number of working hours in a week are: 8(Monday)+8(Tuesday)+8(Wednesday)+8(Thursday)+7(Friday)=39

Chef in his Office CodeChef Solution in Java

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		int x,y;
		for(int i=0;i<t;i++){
		    x = sc.nextInt();
		    y = sc.nextInt();
		    System.out.println(x*4+y);
		}
	}
}

Chef in his Office CodeChef Solution in C++17

#include<bits/stdc++.h>
using namespace std;


int main()
{ 
	
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	
	int t;
	cin>>t;
	while(t--){
		int x,y;
		cin>>x>>y;
		if(x>y){
			cout<<x*4 + y<<endl;
		}
	}
		
		
	return 0;
	
}

Chef in his Office CodeChef Solution in Pyth 3

# cook your dish here
n=int(input())
for i in range(n):
    a,b=map(int,input().split())
    print(a*4+b)
Chef in his Office CodeChef Solution Review:

In our experience, we suggest you solve this Chef in his Office 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 Chef in his Office CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Chef in his Office 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

Leave a Reply

Your email address will not be published.