Computer Science, asked by varshaminal, 2 months ago

There are N chefs (professional cooks) and M newbies (people who have just started cooking)
Masterchef wants to hold a team competition in their kitchen. They can make teams of 2 types where each team contains 3 people
. A team of 1 chef and 2 newbies.
. A team of 2 chefs and 1 newbie.
What is the maximum number of teams that the Masterchef can create for the competition?
Function Description
Complete the masterchef function in the editor below. It has the following parameter(s):
Name
Type
Description
N
Parameters
INTEGER
Number of Chefs
M
INTEGER
Number of Newbies
Return
The function must return an INTEGER denoting the Maximum number of teams.
Constraints
-
1 SNS 10^5
1 SMS 10^5
Input Format For Custom Testing
The first line contains an integer, N, denoting the Number of Chefs.
The next line contains an integer, M, denoting the Number of Newbies.

Answers

Answered by jananisha3699
2

Explanation:

There are N chefs (professional cooks) and M newbies (people who have just started cooking)

Masterchef wants to hold a team competition in their kitchen. They can make teams of 2 types where each team contains 3 people

. A team of 1 chef and 2 newbies.

. A team of 2 chefs and 1 newbie.

What is the maximum number of teams that the Masterchef can create for the competition?

Function Description

Complete the masterchef function in the editor below. It has the following parameter(s):

Name

Type

Description

N

Parameters

INTEGER

Number of Chefs

M

INTEGER

Number of Newbies

Return

The function must return an INTEGER denoting the Maximum number of teams.

Constraints

-

1 SNS 10^5

1 SMS 10^5

Input Format For Custom Testing

The first line contains an integer, N, denoting the Number of Chefs.

The next line contains an integer, M, denoting the Number of Newbies.

Similar questions