June 2022 C/C++ (Level 3) real test analysis#中国电子学院#National Youth Software Programming Level Examination

insert image description here

Question 1: Making the Cake

Little A is good at making banana cakes and chocolate cakes. To make a banana cake requires 2 units of bananas, 250 units of flour, 75 units of sugar, and 100 units of butter. To make a chocolate cake requires 75 units of cocoa powder, 200 units of flour, 150 units of sugar, and 150 units of butter. A banana cake can be sold for 400 yuan, while a chocolate cake can be sold for 450 yuan. In order to prevent the cake from spoiling, no more than 100 of each cake can be made.
Now that the quantity of each raw material is known, find out how much cake A can sell at most.
Time limit: 1000
Memory limit: 65536
input
Enter the quantity of flour, bananas, sugar, butter, cocoa powder in turn, and the quantity of each raw material is an integer not exceeding 100000.
Output
Output an integer indicating the maximum amount of money sold.
Sample input
4000
6
2000
500
500
Sample output
1700

The following is a solution written in C language, which is used to calculate the amount of cakes that A can sell at most:

#include 

Guess you like

Origin blog.csdn.net/gozhuyinglong/article/details/132381448