|
Bzzzzt.. Seems that you want us to do your homework for you.
Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
------------------------------
message: 5
date: Thu, 30 Jan 2020 22:38:41 +0530
from: techie21 IT <techiei876@xxxxxxxxx>
subject: solving a complex problem
Hi,
How to write a program logic for below problem:-
Chef's ingredients:-
1.The chef receives exactly 1 ingredient per day from the market.The
ingredients never repeat.
2. Every ingredient belongs to 1 of the 3 categories namely FIBER,FAT &
CARB.
3.Every ingredient has a unique ingredient id.
4.The ingredient id always starts with the category name
(ex:FIBERBroccoli,FATCheese,CARBRice)
Chef's Dishes
1. All of the chef's dishes have a constant number of ingredients.(this
will be your program's input)
2. All the ingredients used will be fully used in a Dish. The chef doesn'
use some part/quntity of an ingredient.
3.All of the chef's dishes mush have at least 60% of the ingredients from
a single category.(i.e. if the chef cooks using
4 ingredients,then at leaast 3 FAT ingredients OR at least 3 FIBER
ingredients OR at least 3 CARB ingredients are needed)
Chef's Cooking style:-
1. If the chef has multiple options of ingredients for the dish,then he
takes the oldest possible ones to cook in the order of their arrival.
2.After the chef prepares a dish,the ingredients used can Not be reused as
theyhave been already used.
3.The chef prepares a maximum of 1 dish per day.
4.if the Chef does not have enough ingredients to cook the dish with above
mentioned rules,then he does not cook on that day.
Given the input array of ingredient id that the chef receives every day
(i.e. array index is the day number) write a program to print when does the
chef cook a dish and when he does not.
Input:-
Line 1: The total number of days for the scope of the problem(1<=input<=20)
Line 2: The exact number of ingredients that chef uses to
cook(1<=input<=20)
Line 3: The space separated ingredient ids.(6<=length(ingredientid)<=20)
Output:- Print the ":" separated used ingredient ids in order of their
arrival if the chef cooks on that day and print "-" if the chef doesn't
cook anything on that day.Print the output as single string.
Example input 1:
5
3
FATOil FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans
Example INPUT 2:
6
3
FATOil:FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans
EXAMPLE OUTPUT 2:
--FATOil:FATCheese:FATEgg--FIBERSpinach:CARBRice:FIBERBeans
EXAMPLE INPUT 3:
12
4
FATOil FIBERSpinach CARBRice FATCheese FIBERBeans FATEgg FIBERBroccoil
CARBPotato CARBCorn FATOlive FIBERCarrot
Thanks
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.