Question: Please write the function that require below with C language, need it fast, One day, CYLL found an interesting piece of commercial from newspaper: the
Please write the function that require below with C language, need it fast,


One day, CYLL found an interesting piece of commercial from newspaper: the Cyber- restaurant was offering a kind of "Lunch Special" which was said that one could "buy one get two for free". That is, if you buy one of the dishes on their menu, denoted by d; with price Pi, you may get the two neighboring dishes di1 and d;+1 for free! If you pick up d, then you may get d2 and the last one dy for free, and if you choose the last one dn, you may get dn-1 and d for free. However, after investigation CYLL realized that there was no free lunch at all. The price Pi of the 2-th dish was actually calculated by adding up twice the cost c; of the dish and half of the costs of the two "free" dishes. Now given all the prices on the menu, you are asked to help CYLL find the cost of each of the dishes. Format of function: void Price int n, double pl] ); where int n satisfies that 2 #define Max_size 10000 /* max number of dishes */ void Price int n, double pl] ); int main() { int n, i; double p [Max_size]; scanf("%d", &n); for (i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
