Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TO BE CODED IN C + + Mitsuha is traveling to Tokyo to meet Taki Tachibana. She plans to prepare Itomori's best sushi for him,

TO BE CODED IN C++
Mitsuha is traveling to Tokyo to meet Taki Tachibana. She plans to prepare
Itomori's best sushi for him, which requires three main ingredients: Bread (B), Salmon
(S), and Corn (C). She expresses her favourite recipe as a string, such as "BBSCS",
meaning Bread, Bread, Salmon, Corn, and Salmon.
Mitsuha has nb pieces of bread, ns pieces of salmon, and nc pieces of corn in her kitchen.
The nearby shop offers all three ingredients (unlimited supply) at prices pb yen for bread,
ps yen for salmon, and pc yen for corn.
With r yen to spend, what is the maximum number of sushi plates she can prepare,
assuming she cannot break or slice any ingredients?
Input:
Recipe: a string containing only letters B,S,C such that len(string)100
1nb,ns,nc100
1pb,ps,pc100
1r1012
Example 1:
Recipe: BBBSSC
n-b=6,n-s=4,n-c=1
p-b=1,p-s=2,p-c=3
r=4
Output: 2
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

In your own words, describe each method of heat transfer.

Answered: 1 week ago

Question

What financial status will you obtain?

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago